LOCAL loControl WITH THISFORM *** Determine the ratio needed to maximize the form *** depending on screen resolution and store it to form properties .WidthRatio = SYSMETRIC( 1 ) / 640 .HeightRatio = SYSMETRIC( 2 ) / 480 *** If resolution is higher than 640 x 480, reposition *** and maximize the form IF .WidthRatio > 1 .TOP = 0 .LEFT = 0 .WIDTH = .WIDTH * .WidthRatio .HEIGHT = .HEIGHT * .HeightRatio *** And resize each control contained in the form FOR EACH loControl IN .CONTROLS .ResizeControls( loControl ) ENDFOR ENDIF ENDWITHAnd this code in the ResizControls() method:
LPARAMETERS toControl LOCAL loPage, loControl, loColumn, lnColumnWidths[1], lnCol IF PEMSTATUS( toControl, 'Width', 5 ) toControl.WIDTH = toControl.WIDTH * THISFORM.WidthRatio ENDIF IF PEMSTATUS( toControl, 'Height', 5 ) toControl.HEIGHT = toControl.HEIGHT * THISFORM.HeightRatio ENDIF IF PEMSTATUS( toControl, 'Top', 5 ) toControl.TOP = toControl.TOP * THISFORM.HeightRatio ENDIF IF PEMSTATUS( toControl, 'Left', 5 ) toControl.LEFT = toControl.LEFT * THISFORM.HeightRatio ENDIF *** Now resize the font of the control, unless it is a grid or editbox *** in which case we want to see more info IF NOT INLIST( UPPER( ALLTRIM( toControl.BASECLASS ) ), 'GRID', 'EDITBOX' ) IF PEMSTATUS( toControl, 'Fontsize', 5 ) toControl.FONTSIZE = INT( toControl.FONTSIZE * THISFORM.WidthRatio ) ENDIF ENDIF DO CASE CASE UPPER( toControl.BASECLASS ) = 'PAGEFRAME' FOR EACH loPage IN toControl.PAGES THISFORM.ResizeControls( loPage ) ENDFOR CASE INLIST( UPPER( toControl.BASECLASS ), 'PAGE', 'CONTAINER' ) FOR EACH loControl IN toControl.CONTROLS THISFORM.ResizeControls( loControl ) ENDFOR CASE UPPER( toControl.BASECLASS ) = 'GRID' WITH toControl FOR EACH loColumn IN .COLUMNS loColumn.WIDTH = loColumn.WIDTH * THISFORM.WidthRatio ENDFOR ENDWITH CASE INLIST( UPPER( toControl.BASECLASS ), 'COMBOBOX', 'LISTBOX' ) LOCAL lnCol, lnStart, lnEnd, lnLen, lcColumnWidths WITH toControl IF .COLUMNCOUNT < 2 .COLUMNWIDTHS = ALLTRIM( STR( .WIDTH ) ) ELSE lcColumnWidths = '' lnStart = 1 FOR lnCol = 1 TO .COLUMNCOUNT - 1 lnEnd = AT( ',', .COLUMNWIDTHS, lnCol ) lnLen = lnEnd - lnStart lcColumnWidths = lcColumnWidths + IIF( EMPTY( lcColumnWidths ), '', ',' ) + ALLTRIM( STR( VAL (SUBSTR( .COLUMNWIDTHS, lnStart, lnLen ) ) * THISFORM.WidthRatio ) ) lnStart = lnEnd + 1 ENDFOR lnLen = LEN( .COLUMNWIDTHS ) - lnStart + 1 lcColumnWidths = lcColumnWidths + ',' + ALLTRIM( STR( VAL (SUBSTR( .COLUMNWIDTHS, lnStart, lnLen ) ) * THISFORM.WidthRatio ) ) .COLUMNWIDTHS = lcColumnWidths ENDIF ENDWITH CASE INLIST( UPPER( ALLTRIM( toControl.BASECLASS ) ), 'COMMANDGROUP', 'OPTIONGROUP' ) LOCAL lnButton FOR lnButton = 1 TO toControl.BUTTONCOUNT THISFORM.ResizeControls( toControl.BUTTONS[lnButton] ) ENDFOR OTHERWISE *** There is no otherwise...I think we got all cases ENDCASE