WindowState Property

See Also6N36HEJ              Example3YXHDJ6>Low

Applies To

Form14TJ2LN, MDI form1ILMZQ7.

Description

Determines the visual state of a form window at run time.

Usage

[form.]WindowState[ = state ]

Setting

The WindowState property settings are:

Setting          Description

 

0                   (Default) Normal

1                   Minimized (shrunk to an icon)

2                   Maximized (enlarged to maximum size)

 

Remarks

Before a form appears, WindowState is always set to Normal (0), regardless of its initial setting.  This is reflected in the HeightL14VJZ, Left1CIZPD6, ScaleHeight3J8U7ZN, ScaleWidth3J8U7ZN, Top1CIZPD6, and WidthL14VJZ settings.  If a form is hidden after it's been shown, these properties reflect the previous state until the form is shown again, regardless of any changes made to WindowState in the meantime.

Data Type

IntegerDOKXHY (Enumerated)


See Also

Help:

Load Event2S1GYBF

Paint Event25UTDKO

Resize Event2WM7WLP

 

Programmer's Guide:

Chapter 17, "Interacting with the Environment"


WindowState Example

The example hides a dialog box (Form2) when the parent form (Form1) is minimized and redisplays the dialog box when the parent form is returned to either a normal or maximized state.  To try this example, paste the code into the Declarations section of Form1 of an application that contains two forms.  Press F5 to start the example.  Move Form1 around so you can see both forms.  Then minimize or maximize the form and observe the action of Form2.

Sub Form_Load ()

   Form2.Show                            ' Show Form2.

End Sub

Sub Form_Resize ()

   Const MIN = 1

   If Form1.WindowState = MIN Then       ' If parent form is minimized,

      Form2.Visible = False              ' Hide Form2.

   Else                                  ' If form is not minimized,

      Form2.Visible = True               ' Restore Form2.

   End If

End Sub