-
Notifications
You must be signed in to change notification settings - Fork 568
23. High DPI Improvements
As a traditional business, it's possible that you first wrote your WinForms application on a low resolution monitor. Now that you've invested in the latest 4K monitors, you want your application to look just as nice and function properly without having to do any redesign. Luckily, by making a couple edits to your application you'll be able to do this in just a few minutes.
IMPORTANT NOTE: Make sure that your WinForms app is targeting .NET Framework 4.7 or above, otherwise the improvements will not work. You can install .NET Framework 4.7.1 from:
- Visual Studio Installer (Modify)
- .NET Framework Developer Pack
In the following image you can see how to specify to Visual Studio installer to add .NET Framework 4.7.1:
Follow the two simple instructions below to enable High DPI compatibility in your app.
First you'll need to add an app manifest to your WinForms project. To do this you'll want to right click on your project -> Add -> Application Manifest.
Then declare compatibility with Windows 10 by adding the following in your manifest:
<application>
<!-- Windows 10 compatibility -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>
Open the _app.config file in your WinForms project and add the following code:
<add key="DpiAwareness" value="PerMonitorV2" />
</System.Windows.Forms.ApplicationConfigurationSection>
You will now see the improvements and compatibility on your monitor.
NOTE: We are still early in the process of fixing all bug improvements for High DPI compatibility. You may encounter some issues when dragging between screens of different resolutions and/or building on a computer that only supports a lower resolution.
To read about the the latest improvements that have been made for High DPI compatibility you can check out our blog post here.
Continue on to read about testing our newly modernized application. Test the application
- Home
- Release notes
- e-books
-
MVC & Web Forms Samples
- Tour of the "legacy" ASP.NET web apps to modernize
- How to containerize the .NET Framework web apps with Windows Containers and Docker
- Publishing your Windows Container images into a Docker Registry
- Deploying the Apps to Azure Web Apps for Containers
- Deploying the Apps to ACI (Azure Container Instances)
- Deploying your Windows Containers based app into Azure VMs (Including CI CD)
- Deploying into local Kubernetes in Windows 10 and Docker for Windows development environment
- How to deploy your Windows Containers based apps into Kubernetes in Azure Container Service (Including CI CD)
- How to add authentication authorization with Azure Active Directory
- How to migrate the SQL database to Azure with the Azure Database Migration Service
- Using Application Insights in eShopOnContainers
- N-Tier sample: WinForms app and WFC service
- ASP.NET to Azure App Service Migration Workshop