Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anchors of user control don't work when scaling on high DPI (#6381) #11390

Closed
frobijn opened this issue May 16, 2024 · 3 comments
Closed

Anchors of user control don't work when scaling on high DPI (#6381) #11390

frobijn opened this issue May 16, 2024 · 3 comments
Labels
area-Anchor/Scaling HDPI issues around anchoring and docking

Comments

@frobijn
Copy link

frobijn commented May 16, 2024

.NET version

8.0

Did it work in .NET Framework?

Yes

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

Yes: see #6381.

Issue description

Issue #6381 is back. The issue is present when the form is first displayed; resizing afterwards works as expected.

Steps to reproduce

The issue #6381 contains a demo program. That doesn't work correctly with .NET 8. Its behavior is even worse if

Application.SetHighDpiMode (HighDpiMode.PerMonitorV2);

is added. I've also added

<ApplicationHighDpiMode>SystemAware</ApplicationHighDpiMode>
<ForceDesignerDpiUnaware>true</ForceDesignerDpiUnaware>

to the project file as adviced in https://github.com/dotnet/winforms/blob/main/docs/designer/designer-high-dpi-mode.md and opened the forms in the designer, but that did not have any effect.

Updated demp program:
ControlScalingBug_Net8.zip

Application behavior on the high-DPI main monitor:
https://github.com/dotnet/winforms/assets/13610628/882c12fb-c8df-4bfa-8198-dbb118ed09c8

Application behavior on the normal-DPI secondary monitor:
https://github.com/dotnet/winforms/assets/13610628/b4ba58ab-2e04-41a8-8e3b-ad8a5bf6e4fe

@frobijn frobijn added the untriaged The team needs to look at this issue in the next triage label May 16, 2024
@elachlan elachlan added the area-Anchor/Scaling HDPI issues around anchoring and docking label May 16, 2024
@elachlan
Copy link
Contributor

@Olina-Zhang can your team please confirm this issue?

@elachlan elachlan added area-HDPI-SA Issues related to high DPI SystemAware mode area-HDPI-PMv2 Issues related to high DPI PerMonitorV2 mode 💥 regression-release Regression from a public release labels May 16, 2024
@Zheng-Li01
Copy link
Member

@elachlan @frobijn this issue is about the Anchor property, which can resolved by adding the System.Windows.Forms.AnchorLayoutV2": true in the ControlScalingBug.runtimeconfig.json file a below screenshot. please have a try.

Refer the workaround from #10382 (comment)
Issue11390

@elachlan elachlan added 📭 waiting-author-feedback The team requires more information from the author and removed area-HDPI-SA Issues related to high DPI SystemAware mode area-HDPI-PMv2 Issues related to high DPI PerMonitorV2 mode 💥 regression-release Regression from a public release labels May 17, 2024
@frobijn
Copy link
Author

frobijn commented May 17, 2024

Yes, that solves the issue. The option "System.Windows.Forms.AnchorLayoutV2" as a solution to problems with anchoring is impossible to find with a search engine, so it doesn't exist :-)

@frobijn frobijn closed this as completed May 17, 2024
@dotnet-policy-service dotnet-policy-service bot removed untriaged The team needs to look at this issue in the next triage 📭 waiting-author-feedback The team requires more information from the author labels May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Anchor/Scaling HDPI issues around anchoring and docking
Projects
None yet
Development

No branches or pull requests

3 participants