Microsoft KB Archive/138162

= How to Resize a Form When the Application Window Is Resized =

Article ID: 138162

Article Last Modified on 12/11/1999

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition

-



This article was previously published under Q138162



SUMMARY
When you resize an application's window, a form in the application window is not resized accordingly. To resize a form relative to the size of the application window, you can use a timer control.



Step-by-Step Example
 Create a new form. Add two new properties called OldWidth and OldHeight. To do this, on the Form menu, click New Property.  In the Init event of the form, place this code: THISFORM.oldwidth =  _SCREEN.width THISFORM.oldheight = _SCREEN.height  Add a timer control to the form.  In the Timer event of the Timer control, place this code: x=_SCREEN.width y=_SCREEN.height IF ((x!=THISFORM.oldwidth) or (y!=THISFORM.oldheight)) THIS.parent.width=_SCREEN.width-25 THIS.parent.height=_SCREEN.height-25 THISFORM.oldwidth =  _SCREEN.width THISFORM.oldheight = _SCREEN.height THISFORM.AutoCenter=.t.     THISFORM.Refresh ENDIF  Change the Interval property of the Timer control to 100. Run the form. Notice how when you resize the main application window, the form is automatically resized.</li></ol>

Additional query words: VFoxWin form window resize timer

Keywords: KB138162

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.