New per-DPI awareness in VCL applications

Posted by on in UI

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%

1_-_Monitor_left

 

2nd monitor: scaling 125%

2_-_Monitor_center

 

3rd monitor: scaling 150%

3_-_Monitor_right

 

And back to 1st monitor

4_-_Back_to_monitor_left

 


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.



About
Gold User, Rank: 16, Points: 206

Comments

  • Derek S8329
    Derek S8329 Monday, 14 September 2015

    What about Rad Studio itself? It is almost unusable on a 4k monitor with 150% scaling (W10).

  • Borja
    Borja Tuesday, 15 September 2015

    There is an unofficial fix under Codecentral: http://cc.embarcadero.com/Item/30367

  • Luis Navarro
    Luis Navarro Tuesday, 15 September 2015

    Hi Derek.
    Thanks for your reply. We are working hard on adding the High-DPI support for the IDE itself. Making the VCL DPI-aware was the first step.

    Best regards.

  • Derek S8329
    Derek S8329 Tuesday, 15 September 2015

    Thanks for the reply. We'll try the temp fix, otherwise I hope the next update will include high dpi for rad studio.

  • Borja
    Borja Monday, 14 September 2015

    Nice demo, Luis!

  • Please login first in order for you to submit comments
  • Page :
  • 1

Check out more tips and tricks in this development video: