Skip to main content
A newer version of this page is available. .

WindowsFormsSettings.SetPerMonitorDpiAware() Method

Enables “Per-Monitor (v2)” DPI awareness mode for the process if it runs on versions greater than Windows 10 Creators Update (build 1703). On older Windows OS versions, enables system DPI awareness mode.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.Utils.v20.1.dll

NuGet Packages: DevExpress.Utils, DevExpress.Wpf.Core

Declaration

public static void SetPerMonitorDpiAware()

Remarks

Call this method on the application startup.

static class Program {
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    static void Main() {
        WindowsFormsSettings.SetPerMonitorDpiAware()
        //...
        Application.Run(new Form1());
    }
}

To ensure the DPI awareness mode is correctly set up and activated, we recommend to use the DevExpress Project Settings Page.

The SetPerMonitorDpiAware method can apply different DPI awareness modes depending on the Windows version (to check your version, press the “Ctrl+R” hotkey and type “winver”).

  • On Windows 10, version 1607 and later, the SetPerMonitorDpiAware method enables “Per-Monitor (v2)” DPI awareness mode by calling the SetProcessDpiAwarenessContext WinApi function.

  • On older Windows OS versions, the SetPerMonitorDpiAware method enables system DPI-awareness (this method is equivalent to the WindowsFormsSettings.SetDPIAware method in this case).

See Graphics Performance and High DPI and High DPI Desktop Application Development on Windows for information on DPI awareness modes.

See Also