Anchor layout changes

Control anchor computations have been changed to support high DPI devices. For more information about the changes, see Anchor layout changes in .NET 8.

Version introduced

.NET 8 Preview 1

Previous behavior

Certain applications using HighDpiMode.SystemAware or HighDpiMode.PerMonitorV2 mode and anchored controls encountered layout issues on high DPI devices.

New behavior

Applications using HighDpiMode.SystemAware or HighDpiMode.PerMonitorV2 mode and anchored controls should have improved layout when rendered on high DPI devices.

Change category

This change is a behavioral change.

Reason for change

This change is part of a broader effort to improve the Windows Forms user experience on high DPI monitors. It enables developers to use an anchored layout for applications on high DPI devices.

If the new behavior is problematic for you, you can opt out by setting System.Windows.Forms.AnchorLayoutV2 to false in your runtimeconfig.json file.

runtimeconfig.template.json template file:

{
   "configProperties": {
      "System.Windows.Forms.AnchorLayoutV2": false
   }
}

[appname].runtimeconfig.json output file:

{
   "runtimeOptions": {
      "configProperties": {
         "System.Windows.Forms.AnchorLayoutV2": false
      }
   }
}

Affected APIs

N/A

See also