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

New per-DPI awareness in VCL applications

Author: Luis Navarro

In RAD Studio 10 Seattle, we’ve added per-DPI awareness in the VCL. This means that, when moving a form from one monitor to another one that has different DPI, the VCL form and the controls will be rescaled according to the new DPI, with no specific coding needed (video included below).

As a testing scenario, and for this demos: we’ve setup 3 monitors that have different DPIs:

Setup

After that, we ran a sample VCL application and the Visual Studio DPI Awareness Tutorial application side by side. No coding has been added to the VCL app to adapt the form and controls to the different DPIs, there’s only code to get and show the monitor’s settings.

As you can see in the following screenshots, the VCL window and controls are resized according to the DPI of the monitor where is placed (again, no code needed for this behavior). We’ve also used the sample application provided by Microsoft to ensure that everything behaved perfectly.

1st monitor: Scaling 100%

 

2nd monitor: scaling 125%

 

3rd monitor: scaling 150%

 

And back to 1st monitor

 

Bellow there’s a video where you can see the application scaling in real-time with precision and no hiccups.

 In this file you can find the source code for the Delphi application: DelphiDpiAware

And here it is the Microsoft entry for their testing app: https://code.msdn.microsoft.com/windowsapps/DPI-Tutorial-sample-64134744   and the compiled exe:  DPITutorial_exe_VS , please launch adding character p as paramter (to run the Visual Studio sample you may need to install the Visual C++ redistributable packages link: http://www.microsoft.com/en-US/download/details.aspx?id=40784).

An absolutely must have feature, now that is more frequent to find environments with monitors with different DPIs.


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

2 Comments

Leave a Reply to Ian BarkerCancel reply

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

IN THE ARTICLES