Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect menu checkbox bounds #2698

Open
RussKie opened this issue Jan 13, 2020 · 4 comments
Open

Incorrect menu checkbox bounds #2698

RussKie opened this issue Jan 13, 2020 · 4 comments
Assignees
Milestone

Comments

@RussKie
Copy link
Member

@RussKie RussKie commented Jan 13, 2020

  • .NET Core Version:
    latest master @ 6566ad1

  • Have you experienced this same bug with .NET Framework?:
    No

Problem description:

image

Expected behavior:

The checkbox bounds scaled correctly

Minimal repro:

  1. build
  2. Run \winforms\artifacts\bin\WinformsControlsTest\Debug\netcoreapp5.0\WinformsControlsTest.exe
  3. Run "Menus" test
  4. Expand [Project] menu

@hughbe @gpetrou it is likely we regressed in our latest refactors. Could you please have a look?

@hughbe

This comment has been minimized.

Copy link
Contributor

@hughbe hughbe commented Jan 13, 2020

Investigating the code, there's only one place where we draw the check box:

if (CheckState != CheckState.Unchecked && menuItemInternalLayout.PaintCheck)
{
    Rectangle checkRectangle = menuItemInternalLayout.CheckRectangle;
    if (!menuItemInternalLayout.ShowCheckMargin)
    {
        checkRectangle = menuItemInternalLayout.ImageRectangle;
    }
    if (checkRectangle.Width != 0)
    {
        renderer.DrawItemCheck(new ToolStripItemImageRenderEventArgs(g, this, CheckedImage, checkRectangle));
    }
}

Under the debugger, menuItemInternalLayout.CheckRectangle is {5,4,16,16}. menuItemInternalLayout.ShowCheckMargin is false, so we then set checkRectangle to menuItemInternalLayout.ImageRectangle

Now: checkRectangle is {-5,-5,32,32}. Seems like there's a size discrepancy here that may be causing the bug.

Note that this doesn't seem like a recent regression - I can repro resetting to about 3-4 months ago. Can't go any further than that because of missing packages

@RussKie

This comment has been minimized.

Copy link
Member Author

@RussKie RussKie commented Jan 14, 2020

Thank you for the investigation.

@RussKie RussKie self-assigned this Jan 14, 2020
@merriemcgaw merriemcgaw added this to the 5.0 milestone Jan 23, 2020
@merriemcgaw

This comment has been minimized.

Copy link
Member

@merriemcgaw merriemcgaw commented Jan 23, 2020

@Vino-Wang can you try to repro this in 3.0/3.1 to see if it was introduced back in those builds?

@Vino-Wang

This comment has been minimized.

Copy link
Member

@Vino-Wang Vino-Wang commented Jan 23, 2020

@merriemcgaw, verified with .NET Core 3.1, this issue can reproduce and verified with .NET Framework 4.8. it's also can reproduce. Here is the screenshot of .NET Framework app.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.