dotnet / winforms

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

[Multi-Monitor] Controls (with Anchor=Right) scaling incorrectly inside splitContainer #8157

Open Philip-Wang01 opened 1 year ago

Philip-Wang01 commented 1 year ago

.NET version

8.0.100-alpha.1.22559.18

Did it work in .NET Framework?

No

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

No. The fix scaling in SplitContainer controls for HDPI has only been introduced since .Net 8.0. The original issue: https://github.com/dotnet/winforms/issues/3168

Issue description

Current Behavior: Controls (with Anchor=Right) scaling incorrectly inside splitContainer on HDPI

100% DPI primary screen to 300% DPI secondary screen: image

https://user-images.githubusercontent.com/86937911/201048384-56d866ab-2645-4d57-9e73-5d77254aabff.mp4

300% DPI primary screen to 100% DPI secondary screen: image

Expected Behavior: Controls scaling correctly inside splitContainer on HDPI image

Steps to reproduce

  1. Set the primary screen as 100% DPI, and secondary screen 300% DPI.
  2. Open the attached the application. testapp.zip
  3. Build & run the application.
  4. Moving the form from 100% primary screen to 300% secondary screen.
spindisc commented 1 year ago

Also having big issues with SplitContainer. Working on a 200% DPI main screen, Form contains one big vertical SplitContainer, then left side panel contains one horizontal. It was even worse from the beginning, then by adding extra Panel container to each split panel it become a little better, but still worthless.... Images or from design time and runtime. Visual Studio 2022 (17.4.1) - Project Winforms .NET Core 6 - Windows 10 21H2 (19044.2251) runtime designtime

And as you can see, other items also scale wrongly; the columns in the ListView, the icons on the buttons

dreddy-work commented 1 year ago

@spindisc, Is it possible to create a simple repro application mimic your project?

spindisc commented 1 year ago

@spindisc, Is it possible to create a simple repro application mimic your project?

Here is a zip with the application stripped down to minimal code. I also removed the extra panels I used to try get things to work. So now the bare standard controls are in the splitpanels. It is looking really bizarre when I run it. https://www.dropbox.com/s/et8xq5gw9r65fbm/SoundSchemeBuilder.zip?dl=0

image

merriemcgaw commented 1 year ago

@dreddy-work popping this back on your radar.