Skip to content

Child controls overlap the GroupBox border for Standard and Popup styles after switching VisualStylesMode from Classic to NET11 #14832

Closed

Description

@Olina-Zhang

.NET version

.NET 11 SDK build: 11.0.100-rc.1.26380.103

Did it work in .NET Framework?

Not tested/verified

Did it work in any of the earlier releases of .NET Core or .NET 5+?

Not support, new feature of #14811

Issue description

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:

Image

VisualStylesMode = NET11:

Image

Steps to reproduce

  1. Create a WinForms (.NET 11) application.
  2. Add four GroupBox controls with the following FlatStyle values:
  • Standard
  • Flat
  • Popup
  • System
  1. Place a Button and a CheckBox near the top of each GroupBox.
  2. Run the application with VisualStylesMode.Classic.
  3. Switch the Form (or application) to VisualStylesMode.Net11 to run and observe.

Activity

  1. added
    untriaged
    NewApi-Net11
    on Jul 31, 2026
  2. LeafShi1 commented on Aug 7, 2026

    @LeafShi1
    Member

    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:
    Image

    VisualStyleMode = Net11:
    Image

    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:

    1. 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.
    2. 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.

    Image
  3. self-assigned this
    on Aug 7, 2026
  4. added
    waiting-on-team
    and removed
    untriaged
    on Aug 7, 2026
  5. Zheng-Li01 commented on Sep 4, 2026

    @Zheng-Li01
    Member

    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.

    Image
  6. added this to the 12.0-preview1 milestone on Sep 4, 2026
  7. locked and limited conversation to collaborators on Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

NewApi-Net11waiting-on-team

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions