WinForms and High DPI Monitors
.NET 4.0 WinForms High DPI
- Add an app.manifest file
- Modify the app.config file
.NET 4.0 WinForms and High DPI Monitors
The High DPI support for WinForms is a mess.
Microsoft requires these modifications to the project:
-
In the project's app.config file insert these lines before the </configuration> line:
<appSettings>
<add key="EnableWindowsFormsHighDpiAutoResizing" value="true"/>
</appSettings>
-
Add a new app.manifest file to your application's project (Ctrl+Shift+A) and then uncomment these lines:
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>
-
Never run Visual Studio with a Screen resolution other than 100%.
That will screw up the forms editor.
(You probably aren't doing that, but I mention it for completeness.)
Copyright Polar Engineering, Inc.