You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Child controls overlap the GroupBox border for Standard and Popup styles after switching VisualStylesMode from Classic to NET11 #14832
NewApi-Net11Tracks issues for public APIs targeted for .NET 11.waiting-on-teamThis work item needs to be discussed with team or is waiting on team action in order to proceed
When switching a GroupBox from VisualStylesMode.Classic to VisualStylesMode.Net11, child controls are incorrectly positioned for FlatStyle.Standard and FlatStyle.Popup.
After the switch, the child controls (Button and CheckBox)near the top of the GroupBox extend into (or beyond) the GroupBox header/border area instead of remaining within the client area.
FlatStyle.Flat and FlatStyle.System do not exhibit this issue.
VisualStylesMode = Classic:
VisualStylesMode = NET11:
Steps to reproduce
Create a WinForms (.NET 11) application.
Add four GroupBox controls with the following FlatStyle values:
Standard
Flat
Popup
System
Place a Button and a CheckBox near the top of each GroupBox.
Run the application with VisualStylesMode.Classic.
Switch the Form (or application) to VisualStylesMode.Net11 to run and observe.
Based on my testing WinFormsApp1.zip, this does not appear to be caused by a mismatch between painting and layout calculations. When switching from Classic to NET11, the location and the height of the DisplayRectangle changed. This indicates that the GroupBox intentionally exposes a different content area under NET11, and the overlap is a consequence of the changed layout metrics rather than an inconsistency in the control's implementation.
VisualStyleMode = Classic:
VisualStyleMode = Net11:
That said, from an application compatibility perspective, runtime VisualStyle changes remain a supported scenario. Existing child controls preserve their locations while the GroupBox content area shifts, which can lead to visual overlap after switching styles. Therefore, although this may not be a bug in the strict implementation sense, it can still be viewed as a compatibility issue because applications that worked correctly in Classic mode may render differently once NET11 styling is applied.
If we decide to fix this issue, there seem to be three possible approaches, but all have drawbacks:
Option 1: Preserve the NET11 appearance while restoring the Classic DisplayRectangle metrics
To achieve this:
Keep the ClientArea unchanged, make the caption taller, and return the old DisplayRectangle values. However, this would cause the DisplayRectangle to extend into the caption area.
Adjust the ClientArea as well (e.g., if the caption height increases by 12px, increase the ClientArea by 12px too). However, this could affect Anchor, Dock, AutoSize, and LayoutEngine behavior, making it a higher-risk compatibility change.
Option 2: Automatically migrate child controls
Detect a transition from Classic to NET11 and automatically reposition child controls.
However, WinForms currently has no such migration mechanism. The framework also cannot reliably determine which controls should be moved and which were intentionally placed near the border. The implementation would be quite complex and could easily introduce additional compatibility issues.
Option 3: Reduce the size of the caption to match the "Classic" mode
Reduce the size of the caption to match the "Classic" mode, highlighting the visual effects of the FlatStyle solely through border styles without altering the font, this ensures the layout remains unchanged. However, I'm unsure if this is acceptable.
Verified the issue with latest .NET11 11.0.0-rc.2.26453.107 + private dlls built from main branch of dotnet/winforms repro, the issue has been fixed as below screenshot.
NewApi-Net11Tracks issues for public APIs targeted for .NET 11.waiting-on-teamThis work item needs to be discussed with team or is waiting on team action in order to proceed
Activity
LeafShi1 commentedon Aug 7, 2026
Based on my testing WinFormsApp1.zip, this does not appear to be caused by a mismatch between painting and layout calculations. When switching from Classic to NET11, the location and the height of the DisplayRectangle changed. This indicates that the GroupBox intentionally exposes a different content area under NET11, and the overlap is a consequence of the changed layout metrics rather than an inconsistency in the control's implementation.
VisualStyleMode = Classic:

VisualStyleMode = Net11:

That said, from an application compatibility perspective, runtime VisualStyle changes remain a supported scenario. Existing child controls preserve their locations while the GroupBox content area shifts, which can lead to visual overlap after switching styles. Therefore, although this may not be a bug in the strict implementation sense, it can still be viewed as a compatibility issue because applications that worked correctly in Classic mode may render differently once NET11 styling is applied.
@KlausLoeffelmann What do you think about this issue?
If we decide to fix this issue, there seem to be three possible approaches, but all have drawbacks:
Option 1: Preserve the NET11 appearance while restoring the Classic DisplayRectangle metrics
To achieve this:
Option 2: Automatically migrate child controls
Detect a transition from Classic to NET11 and automatically reposition child controls.
However, WinForms currently has no such migration mechanism. The framework also cannot reliably determine which controls should be moved and which were intentionally placed near the border. The implementation would be quite complex and could easily introduce additional compatibility issues.
Option 3: Reduce the size of the caption to match the "Classic" mode
Reduce the size of the caption to match the "Classic" mode, highlighting the visual effects of the
FlatStylesolely through border styles without altering the font, this ensures the layout remains unchanged. However, I'm unsure if this is acceptable.Zheng-Li01 commentedon Sep 4, 2026
Verified the issue with latest .NET11 11.0.0-rc.2.26453.107 + private dlls built from main branch of dotnet/winforms repro, the issue has been fixed as below screenshot.