dotnet / winforms

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

[Multi-Monitor] Controls don't scale well on the secondary monitor when their anchor property is a non-default setting #9209

Closed Philip-Wang01 closed 1 year ago

Philip-Wang01 commented 1 year ago

.NET version

.NET 8.0.100-preview.6.23281.16

Did it work in .NET Framework?

Yes

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

Yes, it works in .NET 6.0/7.0/8.0.100-preview.5.23262.2, doesn't work in 8.0.100-preview.5.23268.15. Regression from https://github.com/dotnet/winforms/commit/31fcf979bb2627373f320c5dd6a970f60b08dcbd.

Issue description

Testapp: Testbuttonanchor.zip

https://github.com/dotnet/winforms/assets/86937911/6f47e140-1371-4ef1-9953-0794ed5338f3

100%DPI: image 100% primary monitor -> 300% secondary monitor image

300% primary monitor -> 100% secondary monitor

https://github.com/dotnet/winforms/assets/86937911/22f01f98-a9f2-4e36-8b7a-ec034009d0e9

Steps to reproduce

  1. Launch VS instance on 100% primary monitor.
  2. Add <ApplicationHighDpiMode>PerMonitorV2</ApplicationHighDpiMode> in csproj file.
  3. Close and reopen Solution.
  4. Add some controls with different anchor properties to form designer.
  5. Build and run the application.
  6. Move to 300% secondary monitor.

More Info:

  1. Designer time does not have the same scaling issues as run time. Designer time has other scaling issues: 5193
  2. This issue does not repro when their anchor property is a default setting.
  3. This issue also occurs when move from 300% primary monitor to 100% secondary monitor.
dreddy-work commented 1 year ago

Duplicate of #9200