PerMonitorV2: DPI scaling not firing ScaleControl when custom Font is used
See original GitHub issue-
.NET Core Version: 6.0, 7.0/main
-
Have you experienced this same bug with .NET Framework?: No (also works in .NET 5)
Problem description:
This is variation of problem reported in #6152 with the twist of setting Font on one of the controls. It is a regression from .NET 5.
Expected behavior:
ScaleControl is called consistently when moving window to display with different DPI.
Minimal repro:
Same repro steps as #6152. The difference is that a custom font is set on one of the UserControls.
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Setting a font form disables autoscaling · Issue #6151
Problem description: Forms with an explicitly set font do not automatically scale on font/DPI size changes. The AutoScaleDimensions property is ...
Read more >Per-Monitor V2 DPI awareness in WinForms not rescaling ...
The test application rescales as the DPI changes. Here is my problem: The legacy software contains a lot of custom fonts on each...
Read more >Fix DPI display issues in Windows Form Designer - Visual ...
Without proper scaling, user interface (UI) elements and text are too tiny to use effectively and can overlap. To help remedy this issue, ......
Read more >WinForms Scaling at Large DPI Settings–Is It Even Possible?
Microsoft added some support for GDI/GDI+ scaling recently. It does not work flawlessly—it generally scales fonts and some graphics.
Read more >Inner details of DPI scaling in Office COM add-ins
In the WndProc method of the form class, the add-in handles the WM_DPICHANGED message to retrieve the form size and the DPI to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

So, our Font got disposed from here when the main window was moved to secondary screen: https://github.com/dotnet/winforms/blob/29e805d6d3e60144a31dad96d848cdcfe454e4eb/src/System.Windows.Forms/src/System/Windows/Forms/Control.cs#L12278-L12282
May be related to https://github.com/dotnet/winforms/issues/6151?