Skip to content

[VisualStylesMode: Net11] ComboBox rounded corners leave background artifacts when the parent background is not a solid color #14799

Description

@ricardobossan

.NET version

Private build from the Net11/Integration-4 branch of https://github.com/KlausLoeffelmann/winforms (run in-repo via WinformsControlsTest).

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 supported, new feature of #14768

Issue description

With VisualStylesMode.Net11, a ComboBox whose parent does not paint a flat BackColor shows mismatched background patches at the rounded field's corners, most visibly top-right and bottom-right.

Image

Cause: ComboBox.ModernComboAdapter.CutOutRoundedCorners fakes the rounding by excluding the rounded path from the control bounds and painting the parent's BackColor into the leftover corner slivers. If the parent actually paints something else (gradient, hatch, BackgroundImage), that fill cannot match its surroundings. The right corners stand out because DrawDropDownButton fills a full-height square rectangle at the right edge before the frame is drawn.

Scope: affects FlatStyle.Standard and Popup (the rounded styles). Flat is square-cornered by design and System bypasses the modern adapter, so neither is affected. On a plain solid-BackColor form the corners render correctly, so this is specific to non-solid parent backgrounds.

Steps to reproduce

  1. WinForms app targeting .NET 11, VisualStylesMode = Net11.
  2. Add a container painting a non-solid background (e.g. a Panel overriding OnPaintBackground with a gradient or hatch brush).
  3. Put a ComboBox with FlatStyle.Standard (or Popup) inside it.
  4. Run; inspect the top-right and bottom-right corners.

Fastest repro: WinformsControlsTest -> Buttons -> "VisualStyles Buttons...", tick "Modern child styles (.NET 11)", and compare the Combo DropDown row (Standard/Popup) against the same control on a plain form. That sample's PatternedGradientPanel is exactly this scenario.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NewApi-Net11Tracks issues for public APIs targeted for .NET 11.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions