WindowState

This property determines whether a form is minimized, maximized or shown at its normal size.

Usage

frmForm.WindowState = nWindowState
nWindowState = frmForm.WindowState

Parameter

Value

Meaning

nWindowState

0

Normal—the current defined size.

1

Minimize to an icon.

2

Maximize to the size specified by MaxHeight and MaxWidth, or to fill the Visual FoxPro window.


You can achieve the same effects with ZOOM WINDOW, but changing WindowState is the OOP way to do this.You can use WindowState to minimize and maximize a form even if it doesn't have Min and Max buttons and even if the window can't be sized because of its BorderStyle. Changes to WindowState fire the form's Resize event, so you can take appropriate action.One weird behavior. If you maximize, then minimize a form, when you then set WindowState to 0 to restore the form, Resize fires twice because the form first maximizes, then returns to its original size.

Example

* This code might be in a form's Resize event (if you're
* using formsets, which we don't)
IF This.WindowState = 2   && maximized
   * move things around so they can be seen
   ThisFormSet.Form2.Left = This.MaxLeft + This.Width
ENDIF

See Also

BorderStyle, MaxButton, MaxHeight, MaxWidth, MinButton, Zoom Window


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .