Article ID: 147596
Article Last Modified on 6/29/2004
** Assumes a screen built at 640x480
LOCAL lnHeight, lnWidth, lnHeightdiff, lnWidthdiff
lnHeight = 480 && The height of the original resolution
lnWidth = 640 && The width of the original resolution
lnHeightdiff = 0 && Variable to hold the height difference
lnWidthdiff = 0 && Variable to hold the width difference
IF SYSMETRIC(2) <> lnHeight && If this is not 640x480 resolution
lnHeightDiff = SYSMETRIC(2) / lnHeight
lnWidthDiff = SYSMETRIC(1) / lnWidth
** You need to remark out the code down to, but not including the,
** ENDIF line of code if this is in the Init of a container object
** such as a page on a pageframe, or any other non-form container
** object that has a Controls and ControlsCount property.
This.Height = This.Height * lnHeightDiff
This.Width = This.Width * lnWidthDiff
This.Top = This.Top * lnHeightDiff
This.Left = This.Left * lnHeightDiff
** The code goes through each object, resizes and
** repositions it.
FOR i = 1 TO This.ControlCount
WITH This.Controls(i)
.Height = .Height * lnHeightdiff
.Width = .Width * lnWidthdiff
.Top = .Top * lnHeightdiff
.Left = .Left * lnWidthdiff
** You could also resize the font at this point
** by changing the FontSize property, perhaps to
** IF TYPE(".FontSize") # "U"
** && The IF ensures the control has a FontSize property
** .FontSize = .FontSize * ((.5 * lnWidthdiff) + (.5 * lnHeightdiff))
** ENDIF
** However, some higher screen resolutions can change
** the appearance of fonts considerably, so testing is
** advised before trying that step.
ENDWITH
ENDFOR
ENDIF
ThisForm.Refresh()
Additional query words: page frame
Keywords: kbhowto kbcode KB147596