Per Monitor V2

From RAD Studio
Jump to: navigation, search

Go Up to VCL


Per Monitor V2 support includes support for its declaration in the IDE Project Options so it sets the proper Windows manifest configuration.

Go to Project > Options > Application > Manifest to enable the Per Monitor V2 option.

PerMonitorV2 Manifest.png

At the core of the VCL library, the support for Per Monitor V2 includes changes to core classes, many controls (platform and custom), and additional styling support.

At the high level, the following changes in the VCL.Classes unit were introduced in 10.3 to support this feature:

  • GetSystemMetricsForWindow global function wraps a call to the new GetSystemMetricsForDPI if available or the traditional GetSystemMetrics if not. It has a handle parameter, passed to the API. We recommend you use this new function in place of the traditional WinApi.GetSystemMetrics function if you want to support Per Monitor V2.
  • The TControl.GetSystemMetrics (nIndex: Integer) method returns the system metrics value for the controls calling the new GetSystemMetricsForWindow global function.
  • TControl.GetCurrentPPI returns the DPI for the control, depending the current monitor and TControl.CurrentPPI is a read-only property mapped to this function.

RAD Studio 10.3 includes significant updates to the VCL and its styling support adopting the new GetSystemMetricsForWindow, and recommend any component writer to do the same for supporting this new Microsoft DPI model. This change might also affect code in your forms, but likely to a less extend. If your code or that of the components you use is not enabled for Per Monitor V2 we recommend you disable this feature in your projects’ manifest file.

Note: Per Monitor V2 support requires at least Windows 10 Creator’s Update (1703). The new methods fall back to the standard behavior and API calls in previous versions of Windows 10 and earlier versions of Windows (there is a specific runtime check in the code).