Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does one support custom Desktop DPI settings in Delphi 7 applications?

We have a few legacy applications that were written in Delphi 7. We've had a few requests over the years to support custom desktop dpi settings in these applications but we have been able to dodge the bullet up till know. Well we can't anymore.

When users set their desktops to say 120dpi some of the controls "fall off" the application or stretches beyond the visible are of the form and specifically the ones that are anchored to the right edge of their parent.

What can I do to prevent this problem WITHOUT open heart surgery.

like image 971
Gerhard Wessels Avatar asked Sep 16 '09 11:09

Gerhard Wessels


1 Answers

As you probably know, this is a well known issue with Delphi forms and interactions with system font sizes.

The default behaviour of a Delphi form is to attempt to scale to respect the (runtime) user's desktop environment. This can have unintended and undesirable side effects however, as you have found.

But the Scaled property (TRUE by default) can be set FALSE to prevent this, but I recommend you read that first article, and also consider the information in this article in order to determine whether this is the right solution in your case.

If you're lucky, simply setting Scaled to FALSE on all your forms may get you a good way there, if not all the way (which may be tedious, but is not exactly open-heart surgery).

like image 159
Deltics Avatar answered Oct 18 '22 13:10

Deltics