Link to home
Start Free TrialLog in
Avatar of delbrad
delbrad

asked on

Sizing forms during runtime when screen resolution is different from one used during designing.

Back again for some expert advice and possible a small example of how to fix the following problem..

How can I during runtime handle the  change of screen resolution and fontsize  when it changes from what I designed the application and still maintain approximately the same size of the form

I have tried the borland Ti2861 Technical Information (Form display  with different resolutions) but when I compile the application and then run it under a different resolution the following happens:
 
(800 by 600 Large Font)  to (640 by 480 Small Font)  the form blows up to fill the whole screen and all components are distorted..

Or when I go from (800 by 600 Large Font) to (800 by 600 Small Font)  the form is reduced to 1/2 of it original size.

Help what am I doing wrong or have I totally messed up in my understanding of the borland technical information.

 
Avatar of delbrad
delbrad

ASKER

Edited text of question
ASKER CERTIFIED SOLUTION
Avatar of millerw
millerw

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
NOTE: This applies to only Delphi 1.

If you have DELPHI source, you might try this fix.

Excerpt from Delphi Bug Lists are maintained by Reinier Sterkenburg:

The property access method SetWidth has a bug, when using a screen resolution with Large Fonts.

Description:
When your screen is configured in a high resolution with Large Fonts, setting the size of a TMetafile object makes its width too large.
This is caused by the fact that in the SetWidth method of TMetafile, a division by 96 is done, where the expression shpuld be divided by Screen.PixelsPerInch (in many cases the value is 96, but it can also be 120).

Solution:
When you have the VCL source, change the line (unit Graphics, procedure TMetafile.SetWidth)
      Value := MulDiv(Value, FInch, 96);
to
      Value := MulDiv(Value, FInch, Screen.PixelsPerInch);