Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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


View products that this article applies to.

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.

↑ Back to the top


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.

↑ Back to the top


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.

↑ Back to the top


Keywords: kbbug, kbsurveynew, kbexpertiseadvanced

↑ Back to the top

Article Info
Article ID : 4012107
Revision : 15
Created on : 4/5/2017
Published on : 4/5/2017
Exists online : False
Views : 268