Back to Devexpress

WindowsFormsSettings.SetDPIAware() Method

windowsforms-devexpress-dot-xtraeditors-dot-windowsformssettings-03eb18c5.md

latest6.2 KB
Original Source

WindowsFormsSettings.SetDPIAware() Method

Enables system DPI awareness mode for the current process.

Namespace : DevExpress.XtraEditors

Assembly : DevExpress.Utils.v25.2.dll

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

Declaration

csharp
public static void SetDPIAware()
vb
Public Shared Sub SetDPIAware

Remarks

In system DPI awareness mode, applications scale controls based on the DPI setting of the primary monitor. When the application is moved to a monitor with a different scale factor, the window is scaled by the system, making controls appear blurry.

The SetDPIAware method delegates its execution to the SetProcessDPIAware WinApi method.

To enable “Per-Monitor (v2)” DPI awareness mode, use the WindowsFormsSettings.SetPerMonitorDpiAware method.

See High DPI Desktop Application Development on Windows to learn more.

The following code snippets (auto-collected from DevExpress Examples) contain references to the SetDPIAware() method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-map-load-data-from-a-sql-geometry-data-source/CS/SqlGeometry/Program.cs#L15

csharp
static void Main() {
    WindowsFormsSettings.SetDPIAware();
    WindowsFormsSettings.AllowDpiScale = true;

winforms-charts-create-real-time-chart/CS/RealTimeChartUpdates/Program.cs#L10

csharp
static void Main() {
    WindowsFormsSettings.SetDPIAware();
    WindowsFormsSettings.AllowDpiScale = true;

winforms-charts-create-real-time-chart-and-collect-data-in-separate-thread/CS/RealTimeChartUpdates/Program.cs#L11

csharp
WindowsFormsSettings.ForceDirectXPaint();
WindowsFormsSettings.SetDPIAware();
WindowsFormsSettings.AllowDpiScale = true;

winforms-map-create-different-map-shapes/CS/MapItemsExample/Program.cs#L15

csharp
static void Main() {
    WindowsFormsSettings.SetDPIAware();
    WindowsFormsSettings.AllowDpiScale = true;

winforms-charts-create-stacked-bar-chart/CS/Series_StackedBarChart/Program.cs#L13

csharp
static void Main() {
    WindowsFormsSettings.SetDPIAware();
    WindowsFormsSettings.AllowDpiScale = true;

winforms-map-load-data-from-a-sql-geometry-data-source/VB/SqlGeometry/Program.vb#L14

vb
Sub Main()
    Call WindowsFormsSettings.SetDPIAware()
    WindowsFormsSettings.AllowDpiScale = True

winforms-charts-create-real-time-chart/VB/RealTimeChartUpdates/Program.vb#L11

vb
Sub Main()
    Call WindowsFormsSettings.SetDPIAware()
    WindowsFormsSettings.AllowDpiScale = True

winforms-charts-create-real-time-chart-and-collect-data-in-separate-thread/VB/RealTimeChartUpdates/Program.vb#L12

vb
Call WindowsFormsSettings.ForceDirectXPaint()
Call WindowsFormsSettings.SetDPIAware()
WindowsFormsSettings.AllowDpiScale = True

winforms-map-create-different-map-shapes/VB/MapItemsExample/Program.vb#L14

vb
Sub Main()
    Call WindowsFormsSettings.SetDPIAware()
    WindowsFormsSettings.AllowDpiScale = True

winforms-charts-create-stacked-bar-chart/VB/Series_StackedBarChart/Program.vb#L14

vb
Sub Main()
    Call WindowsFormsSettings.SetDPIAware()
    WindowsFormsSettings.AllowDpiScale = True

See Also

SetPerMonitorDpiAware()

WindowsFormsSettings Class

WindowsFormsSettings Members

DevExpress.XtraEditors Namespace