dotnet / winforms

Windows Forms is a .NET UI framework for building Windows desktop applications.
MIT License
4.42k stars 984 forks source link

Incorrect scaling of MDI child forms #11815

Open Camel-RD opened 3 months ago

Camel-RD commented 3 months ago

.NET version

.net 8.0, 9.0 Preview6

Did it work in .NET Framework?

Yes

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

No

Issue description

The MDI child form for auto-scaling is using the current font of the MDI parent form instead of default application font. When an MDI child form is shown, it uses the font of its parent but doesn't perform auto-scaling. A possible workaround would be to set the form font in the constructor.

Steps to reproduce

  1. Change font size of the MDI parent form
  2. Don't set the font of the MDI child form
  3. Open MDI child form
  4. Notice the incorrect scaling of controls on the child form.

TestMDIAudoScaling.zip

elachlan commented 3 months ago

@Olina-Zhang can your team please test?

Philip-Wang01 commented 3 months ago

@elachlan This issue can be reproduced in .NET 6.0 and above and .NET Framework projects

https://github.com/user-attachments/assets/92ece939-fef3-4d27-90bd-45410495a949

Camel-RD commented 3 months ago

.Net Framework doesnt have this issue

merriemcgaw commented 3 months ago

@Philip-Wang01 can you confirm which of the Framework versions are doing this?

Philip-Wang01 commented 3 months ago

@merriemcgaw Sorry for some problems with the previous project configuration, this issue is not reproduced in .NET Framework 4.7.2 - 4.8.1

https://github.com/user-attachments/assets/aac7727f-a96b-48d8-981d-7a13b78c59d0