Forms scale according to AutoScaleMode
In PerMonitorV2-mode apps, Windows Forms has been using linear sizes (also known as DPI-scaled sizes) provided by Windows for top-level windows, regardless of the AutoScaleMode. This implementation was problematic when using the AutoScaleMode.Font scaling mode, where Form scaling should be non-linear. The child controls are scaled non-linearly and depend on the font that was assigned to the Form or child controls.
This change enables WM_GETDPISCALEDSIZE
message handling for top-level Form objects. It utilizes WM_GETDPISCALEDSIZE to let Windows know that the Form may need non-linear sizes depending on AutoScaleMode.
Version introduced
.NET 8 Preview 1
Previous behavior
Previously, in PerMonitorV2-mode apps, top-level windows were scaled by Windows and disregarded AutoScaleMode as specified in the WinForms application. This implementation led to inconsistent scaling between Form objects and their child controls.
New behavior
In PerMonitorV2-mode apps, top-level windows (such as Forms) are scaled according to AutoScaleMode. This implementation ensures that top-level windows scale consistently with their child controls.
Change category
This change is a behavioral change.
Reason for change
This change was made to improve the high-DPI experience for Windows Forms apps in PerMonitorV2 mode.
Recommended action
No action is required.
Affected APIs
N/A