How to Resize a Form When the Application Window Is Resized
ID: Q138162
|
The information in this article applies to:
-
Microsoft Visual FoxPro for Windows, version 3.0
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.
MORE INFORMATIONStep-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.
Additional query words:
VFoxWin form window resize timer
Keywords :
Version : WINDOWS:3.0
Platform : WINDOWS
Issue type :
|