DevExpress Manifest for Per-Monitor DPI-Aware VCL Applications
- 4 minutes to read
An application manifest determines how the application responds to monitor DPI changes. This topic describes different manifest elements related to DPI awareness.
DPI-Unaware Applications
DPI-unaware applications include no special elements in their manifests. The host operating system scales a DPI-unaware application as a bitmap. As a result, an application may display blurry text, icons, and other UI elements on a high-DPI monitor.
DPI-Aware Modes
A DPI-aware application adapts its content to the target monitor’s DPI. A DPI-aware application’s manifest should include the dpiAware element in “True/PM” state to notify the host operating system that the application process has:
- System DPI awareness on Microsoft Windows® Vista, 7, and 8
- Per-monitor DPI awareness (v1) on Microsoft Windows® 8.1 and 10
Since Microsoft Windows® 10 build 1607, application manifests can include the dpiAwareness element in addition to dpiAware. The new element’s status items clarify how an application responds to monitor DPI changes if the manifest includes the dpiAware element in “True/PM” state. The new element’s status items notify the host operating system of how an application should respond to monitor DPI changes:
The “system” item indicates that the application scales at launch according to the DPI value of the primary display at the time of a user session start.
The “permonitor” item corresponds to the per-monitor DPI awareness (v1) and notifies the host operating system that the application scales its visual elements dynamically in response to every monitor DPI change. In this mode, the operating system stretches or shrinks bitmap elements of scaled non-client window areas (such as the caption bar, scrollbars, etc.), system dialogs, and Native Theme-painted controls (such as a check mark glyph in a native-painted checkbox). These scaled bitmap elements can become blurry as a result.
The “permonitorv2” item is supported since Creators Update (build 1703) and corresponds to the extended per-monitor DPI awareness (v2). This mode addresses the limitations of its first version. The operating system offers multiple bitmap series created for multiple target DPIs (96, 120, 144, etc.) for each bitmap element of non-client window areas, system dialogs, and native-painted controls. Every time a monitor DPI changes, all such bitmaps are replaced with the corresponding versions specifically created for the new target DPI.
GDI Scaled Mode
Since Microsoft Windows® 10 build 1809, application manifests can include the gdiScaling element. It enables GDI Scaled mode in “True” state. In this mode, an application is unaware of DPI changes but the operating system automatically scales text and GDI-based primitives in high quality.
Note
DirectX hardware acceleration is unavailable if an application enables GDI Scaled mode because it draws DirectX-rendered controls unscaled at their original (unscaled) positions. If your application’s manifest includes the gdiScaling element in “True” state, all DevExpress controls use GDI instead of DirectX render mode to avoid UI scaling issues.
IDE Manifest Options
Different RAD Studio IDE versions offer different ways to adapt an application manifest to high DPI environments.
Enable DPI Awareness
In RAD Studio 10.3 Rio or newer, you can select any DPI awareness support level in the “DPI Awareness” combo box on the dedicated Manifest page of the Application settings group.
In RAD Studio versions from 10 Seattle to 10.2 Tokyo, you can check “Enable High-DPI” on the Application tab in project settings. This adds per-monitor DPI awareness v1 to the application manifest. To use v2 instead, link the dxDPIAwareManifestPM2.res resource file located in “<DevExpress VCL installation folder>”\ExpressCore Library\Sources”.
Older RAD Studio versions have no DPI awareness-related options in project settings. In this case, you can use the manifest shipped with the Express Cross Platform Library. Add the {$R dxDPIAwareManifest.res}
or {$R dxDPIAwareManifestPM2.res}
compiler directive to existing project code to enable per-monitor DPI awareness v1 or v2 in your application.
Enable GDI Scaled Mode
In RAD Studio 11 Alexandria or newer, you can select the “GDI Scaling” option in the “DPI Awareness” combo box on the dedicated Manifest page of the Application settings group.