An empty form is not scaled to the new level when you run a DPI-aware application on a different scaling level in .NET Framework 4.7

Applies to: .NET Framework 4.7

Symptoms


Assume that you have a Windows Forms DPI-aware application on a computer that has the .NET Framework 4.7 installed. After you add all required configuration settings changes to a new project (and you make no other changes), and then you run the application on a different scaling level, the empty form is not scaled to the new level as expected.

Cause


This issue occurs because of the following reasons:

  • By default, AutoScaleDimensions property is not serialized. Therefore, there is no way to know at runtime whether the form should be scaled or whether the sizes are already scaled.
  • If the AutoScaleDimensions property is defined, it does not force a rescaling pass if no property is set on the form (or no controls are added). You can safely assume that if no property was changed, there is nothing to scale.

Workaround


To work around this issue, add any control to the form to make the scaling work correctly.

This issue is expected to be resolved in the .NET Framework 4.7.1.

For more information about known issues in the .NET Framework 4.7, see Known issues for .NET Framework 4.7.