Open AngeloCresta opened 2 years ago
This looks like what https://github.com/dotnet/winforms/pull/4739 is trying to address.
Agree, plus the right border on toolstrip and menustrip ;)
Would you like to try to fix the other one?
Why not?! Let me know...
Why not?! Let me know...
@AngeloCresta , please go ahead. I marked this for up for grab.
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:
without the padding (with a split container docked, with DWM composition(*)):
Without the padding (with a split container docked, without DWM composition):
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")]
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!
.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):
Expected behavior: Same application, same "ToolStripProfessionalRenderer" in .Net Framework 4.8, the borders are drawn correctly:
Best Regards, Angelo