See Also Example
Applies To
Form, MDI form
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 Height , Left , ScaleHeight , ScaleWidth , Top , and Width 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
Integer (Enumerated)
Help:
Load Event
Paint Event
Resize Event
Programmer's Guide:
Chapter 17, "Interacting with the Environment"
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