Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IconPictureBox reduces scale of entire application #23

Closed
rqsanderson opened this issue Sep 13, 2019 · 4 comments
Closed

IconPictureBox reduces scale of entire application #23

rqsanderson opened this issue Sep 13, 2019 · 4 comments
Assignees
Labels

Comments

@rqsanderson
Copy link

When an IconPictureBox is instantiated on a form in a WinForms application, it reduces the display scale of the ENTIRE application to the Windows out-of-the-box standard 96 dpi. This is a rather annoying issue for users who prefer to run at a higher logical dpi.

To reproduce, make sure your system settings are as follows, before running your application:

System: Windows 10
System fundamental dpi: 96
Monitor scaling: 125% (120 dpi)
App forms are set to AutoScaleMode = Font

When you run your application, as soon as an IconPictureBox is instantiated with new in the designer file's InitializeComponent method, the application will immediately shrink to the system dpi for the remainder of the time the application is running.

@mkoertgen
Copy link
Member

Hi @rqsanderson, thanks for reporting. Will look into it.

@mkoertgen mkoertgen added the bug label Sep 16, 2019
@mkoertgen mkoertgen self-assigned this Sep 16, 2019
@mkoertgen
Copy link
Member

mkoertgen commented Oct 6, 2019

After a short investigation the rescaling is not related to the IconPictureBox but all Windows Forms items that initialize the font resources. For instance, instantiating an IconPictureBox or an IconButton has the same effect as described above.

The setting of AutoScaleMode on the main form does not seem to have any effect on this.

Probably related to DPI virtualization, cf.:

@mkoertgen
Copy link
Member

mkoertgen commented Oct 6, 2019

On Windows 10 (.NET 4.7+) you can enable DPI awareness in your windows forms application by adding

<System.Windows.Forms.ApplicationConfigurationSection>
  <add key="DpiAwareness" value="PerMonitorV2" />
</System.Windows.Forms.ApplicationConfigurationSection>

to your app.config. For more information see

@mkoertgen
Copy link
Member

@rqsanderson Closing this issue since a workaround exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants