views:

457

answers:

1

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.

+1  A: 

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).

Deltics
Ah, you beat me a few seconds, and your answer is better/more complete. I'll delete my similar answer. :-)
robsoft
-1 for the tip to even consider simply setting `Scaled` to `False`. One can do that, but only with complete runtime resizing and repositioning of all controls. Preferably after setting the proper system font (determined at runtime) for each form. No scaling or runtime resizing whatsoever is just cruelness towards those with impaired vision and/or a high DPI screens.
mghie