Open Grebnietz opened 10 months ago
@Olina-Zhang could your team please verify?
.NET version
9.0.100-alpha.1.23604.8
Did it work in .NET Framework?
Yes, but the result is different with .NET 9.0. The detailed .NET Framework 4.8.1 result is below:
HDPI primary monitor
100% scan secondary monitor
Did it work in any of the earlier releases of .NET Core or .NET 5+?
From .NET 7.0 to the latest .NET 9.0, they are the same result. Only .NET 6.0 result is different and its result is below:
HDPI primary monitor
100% scan secondary monitor
Issue description
When launch project and open form on HDPI primary monitor, the Modal result is correct, but Modeless result is incorrect. Show Modal: correct
Show Modeless: incorrect
When move the form to 100% scale secondary monitor, the Modal result is incorrect, but Modeless result is correct. Show Modal: incorrect
Show Modeless: correct
https://github.com/dotnet/winforms/assets/45864985/1a9d508d-8189-49ec-a71f-3177ad442887
Steps to reproduce
Thanks for filing the issue @Grebnietz! This will go on our backlog of HDPI issues. Was I correct in reading that calling CenterToParent()
solves the problem for your app for now?
Thanks for filing the issue @Grebnietz! This will go on our backlog of HDPI issues. Was I correct in reading that calling
CenterToParent()
solves the problem for your app for now?
@merriemcgaw : Yes, correct! Calling CenterToParent "resolvse" the issue.
.NET version
.NET SDK: Version: 7.0.404 Commit: 22f221a24c
Did it work in .NET Framework?
Not tested/verified
Did it work in any of the earlier releases of .NET Core or .NET 5+?
The behaviour on .NET 6 is difference to .NET 7, but also not correct.
Issue description
I have a Form that is opened as Modal (.ShowDialog()) with
StartPosition = FormStartPosition.CenterParent;
But on my Secondary-Screen with 100% scaling, the Modal Dialog is not centered to it's parent. But a Modeless Dialog (.Show()) is centered!On my Main-Screen with 125% scaling, the Modal Dialog is correctly centered, but the Modeless Dialog is not centered.
However if I call
CenterToParent();
in Load-Event of the Form, the form is correctly centered.The fix of issue #5729 seems not handle this case.
In .NET Framework 4.7.2 it seems that Modless Dialogs never centered.
Steps to reproduce
Create a new Default .NET Winforms App.
Setup the DpiAwareness Mode in Main()-Method
Application.SetHighDpiMode(HighDpiMode.PerMonitorV2);
Create a second Form that is called from the Mainform. Second Form is set to
StartPosition = FormStartPosition.CenterParent;
Dialog_CenterParent.zip