A library for enabling DPI awareness in a Windows Forms application.
- Download the Dpi Awareness library.
- Extract to any location.
- Add libDpi.dll to your project's references.
- Set the AutoScaleMode of the Forms used in your project to Dpi.
- Add the following code to the Program.cs file.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms; // <-- Necessary
namespace ExampleApp
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
DpiAwareness.Enable(); // <-- Enable DPI Awareness
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new ExampleForm());
}
}
}