High DPI Patches For Delphi

It took quite a while, but finally I have come to an agreement with Embarcadero that enables me to publish my High DPI Patches for Delphi 10.2 Tokyo Update 3. The impatient among my readers can download the zip file directly from here:  High DPI Patches , but please try to hold back until you have read the whole article!

These patches are an export from a Mercurial repository. Nevertheless you should be able to apply them with any decent patch tool. The VCL sources are expected in the sub folder source\vcl and it will only work on the sources that come with Delphi 10.2 Tokyo Update 3! Perhaps it doesn’t matter, but I suggest to apply the patches in the given order.

After applying the patches add that source\vcl path to your search path and make a build (a simple compile is not sufficient).

Also make sure that you include the manifest found in the download in your project.

Besides patching most of the High DPI issues currently mentioned in Quality Portal I also made some changes to the implementation for owner drawn menus, not directly necessary for High DPI. Owner drawn menus are not only used when you provide an event handler for that, but also when you connect an imagelist to the menu. The original implementation unfortunately shows some differences to the built-in Windows menus as shown in these screenshots:

Standard Windows Menu
Owner Draw Menu

The Windows menu seems to arrange the menu caption and the shortcut in separate columns, while the owner drawn menu somehow interlaces them. That was one thing annoying me for quite some time, so I thought this would be a good opportunity to get this right.

I wasn’t able to get it up to 100% mostly because Windows doesn’t provide the metrics for that, but it is quite close.

Hope this will help some of you to provide proper High DPI support for your applications.

 

Author: Uwe Raabe

Addicted to Pascal/Delphi since the late 70's