DynaPDF Manual - Page 26

Previous Page 25   Index   Next Page 27

Language Bindings
Page 26 of 787
DPI Aware .Net applications
The difference of dpi aware applications in comparison to regular applications is that the latter
one do not properly scale on high resolution displays. Blurry text is an indication that an
application is not dpi aware.
C# PDF viewer example with disabled and enabled high dpi support:
As you can see above the treeview control does not properly scale. The same control looks much better when rendered in a lower resolution. Such
issues require some fine tuning for optimal results.
A user can of course right click on the executable and change the high dpi settings in the
compatibility section of the application properties. This works pretty well with Windows 10
Version 2004 but every major version of Windows 10 behaves differently and we have currently
11 major versions of Windows 10!
A bit annoying is also the fact that these settings do generally not work if the application was
copied to a RAM disk on Windows 10 Version 2004. This was no issue in earlier versions.
So, it would be much better to enable high dpi support without additional user interaction. In
earlier days high dpi support needed to be enabled with a dpi aware manifest. This worked for
a while until the way was changed how high dpi support must be enabled.
The new way of enabling high dpi support is to add a section to the app.config file.
Enabling High DPI support in Windows Forms Apps
To get high dpi support enabled in Windows Forms Apps you must first change the version of
the used .Net framework to 4.7 or higher.
If you do this in the settings of the PDF viewer example, for example, then you'll notice that the
required app.config fille will be added automatically to the solution. Double click on it and copy
the code marked in yellow into the configuration tag:
<?xml version="1.0" encoding="utf-8"?><configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup>
<System.Windows.Forms.ApplicationConfigurationSection>
<add key="DpiAwareness" value="PerMonitorV2" />
</System.Windows.Forms.ApplicationConfigurationSection>
</configuration>
 

Previous topic: Requirements to add your own code to DynaPDF

Next topic: Scrolling issues on high dpi devices, Static contents in dpi aware applications

Start Chat