Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
C++DelphiRAD Studio

Quickly Migrate and Modernize Your Delphi/C++ Apps Using FastReport With Windows High DPI Setup

Display panel manufacturers have packed an increasing number of pixels into each unit of physical space on their panels resulted in the dots per inch (DPI) of modern display panels. In the past, most displays had 96 pixels per linear inch of physical space (96 DPI); in 2017, displays with nearly 300 DPI or higher are readily available. Variety of monitors like SD, Full HD, 4K Ultra HD, 8K Ultra HD in the market.

We have laptops, desktops with small screens, and without display scale factor/DPI changes it’s very hard to use it and this can be even more complicated when talking about Full HD, 4K Ultra HD, 8K Ultra HD. Our application should be able to handle them. You cannot be sure what every user prefers.

Some common scenarios where the display scale factor/DPI changes are:

  • Multiple-monitor setups where each display has a different scale factor and the application is moved from one display to another (such as a 4K and a 1080p display)
  • Docking and undocking a high DPI laptop with a low-DPI external display (or vice versa)
  • Connecting via Remote Desktop from a high DPI laptop/tablet to a low-DPI device (or vice versa)
  • Making display-scale-factor settings change while applications are running

Desktop applications must tell Windows if they support DPI scaling. By default, the system considers desktop applications DPI unaware and bitmap-stretches their windows. By setting one of the Unaware, System, Per-Monitor, and Per-MonitorV2. available DPI awareness modes, applications can explicitly tell Windows how they wish to handle DPI scaling.

When updating a System DPI-aware application to become Per-MonitorV2 aware, the code which handles UI layout needs to be updated such that it is performed not only during application initialization but also whenever a DPI change notification (WM_DPICHANGED in the case of Win32) is received.

Things to know on migrating your Delphi Application to High DPI ?

  • Set the DPI awareness Mode in Project->Options->Application->Manifest-DPI Awareness and Select Per-MonitorV2.
  • Use Sceen.PixelsPerInch-primaryDispaly DPI
  • Use TVirtualImageList instead of TImageList.
  • Check all custom draw for absolute positions
  • Use Control.CurrentPPI to get Current PPI of Control
  • Mixed Mode for dialogs(SetThreadDPIAwarenesscontext)
  • Use Form events OnBeforeMonitorDPIChanged/OnAfterMonitorDPIChanged.

Note: Ensure backward compatibility for your platform and Delphi version of your application.

Some of the Delphi And FastReport High DPI Controls:

  • TControl: procedure such as ScaleforPPI, ChangScale, ScaleControlsForPPI helps for High DPI change.
  • TFrxBAseForm: procedure such as UpdateResources, UpdateFormPPI, ProcessPreferences, and Message WM_DPICHANGED helps for FastReport form DPI change.
  • TFrxDPIAwareCustomControl: procedure such as DoPPIChanged, GetScale, and Message WM_DPICHANGED_AFTERPARENT helps for FastReport custom control DPI change.

Check out the Video Fast Migration to Windows 10 High DPI, below for Demonstration.

Check the latest RAD Studio 10.4.1 Features which includes VCL Style Changes for High DPI.


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES