Skip to content

ContainerControl incorrectly scales multiple times when moving from one ControlCollection to another. #12851

@ChristopherDShea

Description

@ChristopherDShea

.NET version

.NET 8.0

Did it work in .NET Framework?

Yes

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

Sample project appears to work in .NET 6.

Issue description

Setup:
The parent form has AutoScaleMode set to DPI, and is being shown on a display with resolution that would cause the form to scale (i.e. not 100%).

Issue:
When a ContainerControl is removed from one Controls collection and added to another, the ContainerControl is scaled multiple times (based on the default and inherited fonts?), leading to the size of the control changing each time it is moved.

Notice in the animation below, the size of the TextBox remains static, while the red ContainerControl gets longer.
Image

Steps to reproduce

ContainerControlSample.zip

  1. Run the sample on a display set above 100%.
  2. Click button3 on the initial Form2 to pull up the Form4 with the issue.
  3. Repeatedly click button1 on Form4.

Results:
The red ContainerControl gets longer with each button1 click.

Metadata

Metadata

Assignees

Labels

💥 regression-releaseRegression from a public releasearea-HDPIHDPI, not specific to Dpi mode of app

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions