awesome-inc / FontAwesome.Sharp

A library for using Font Awesome in WPF & Windows Forms applications
Apache License 2.0
385 stars 89 forks source link

IconPictureBox reduces scale of entire application #23

Closed rqsanderson closed 4 years ago

rqsanderson commented 5 years ago

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 commented 4 years ago

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

mkoertgen commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

@rqsanderson Closing this issue since a workaround exists.