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

MenuStrip, ToolStrip and StatusStrip white border issue #5421

Open
AngeloCresta opened this issue Aug 12, 2021 · 7 comments
Open

MenuStrip, ToolStrip and StatusStrip white border issue #5421

AngeloCresta opened this issue Aug 12, 2021 · 7 comments
Labels
Milestone

Comments

@AngeloCresta
Copy link

  • .NET Core Version:
    .NET SDK (reflecting any global.json):
    Version: 5.0.302
    Commit: c005824e35

    Runtime Environment:
    OS Name: Windows
    OS Version: 10.0.22000
    OS Platform: Windows
    RID: win10-x64
    Base Path: C:\Program Files\dotnet\sdk\5.0.302\

    Host (useful for support):
    Version: 5.0.8
    Commit: 35964c9215

    .NET SDKs installed:
    5.0.103 [C:\Program Files\dotnet\sdk]
    5.0.302 [C:\Program Files\dotnet\sdk]

    .NET runtimes installed:
    Microsoft.AspNetCore.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
    Microsoft.AspNetCore.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
    Microsoft.NETCore.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
    Microsoft.NETCore.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
    Microsoft.WindowsDesktop.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
    Microsoft.WindowsDesktop.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

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

Problem description:
if the "strips" have dark colors (via professional renderer) a white border (on the left for toolstrip and menustrip and statusstrip, and on the bottom for statusstrip) cannot be avoided.

White border near the form border (.Net Core 5):

image
image
image

Expected behavior:
Same application, same "ToolStripProfessionalRenderer" in .Net Framework 4.8, the borders are drawn correctly:

image

Best Regards,
Angelo

@RussKie
Copy link
Member

RussKie commented Aug 16, 2021

This looks like what #4739 is trying to address.

@AngeloCresta
Copy link
Author

Agree, plus the right border on toolstrip and menustrip ;)

@RussKie
Copy link
Member

RussKie commented Aug 17, 2021

Would you like to try to fix the other one?

@AngeloCresta
Copy link
Author

Why not?! Let me know...

@dreddy-work
Copy link
Member

Why not?! Let me know...

@AngeloCresta , please go ahead. I marked this for up for grab.

@dreddy-work dreddy-work added the help wanted Good issue for external contributors label Aug 19, 2021
@AngeloCresta
Copy link
Author

This week I had time to dig a bit into this, and I've found something interesting, the issue is not (only) with the toolbars, but it seems with the DWMComposition (*) and Windows 11 (build > 220000).
If you have a custom form with no standard border (let's say 1px) and a paddind of 1 px, the composition is not able to draw the child controls docked into the parent (Form), addind at least 2px on bottom and on the right the compostion is able to round the edges, design the border, without having the ugly white space.

this shows the extra 1 px padding:
image

without the padding (with a split container docked, with DWM composition(*)):
image

Without the padding (with a split container docked, without DWM composition):
image

I'm not sure if this helps, this issue can be closed: it'a strange but quite logical behaviour...

Ciao /// Angelo

(*)

        public static bool WindowBorderlessDropShadow(IntPtr hWnd, int ShadowSize)
        {
            MARGINS Margins = new MARGINS(0, ShadowSize, 0, ShadowSize);
            int result = DwmExtendFrameIntoClientArea(hWnd, ref Margins);
            return result;
        }

Where int ShadowSize shoud at least be 2px (to let DWM draw ...) and DwmExtendFrameIntoClientArea is:

        public static extern int DwmExtendFrameIntoClientArea(IntPtr hWnd, ref MARGINS pMarInset);
       [DllImport("dwmapi.dll")]

@RussKie RussKie added up-for-grabs-temp help wanted Good issue for external contributors and removed help wanted Good issue for external contributors up-for-grabs-temp labels May 5, 2022
@ghost ghost added this to the Up-for-grabs milestone May 5, 2022
@ghost
Copy link

ghost commented May 5, 2022

This issue is now marked as "up for grabs", and we’re looking for a community volunteer to work on this issue. If we receive no interest in 120 days, we will close the issue. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants