See Also Example
Form, MDI form.
Determines the visual state of a form window at run time.
[form.]WindowState[ = state ]
The WindowState property settings are:
0 (Default) Normal
1 Minimized (shrunk to an icon)
2 Maximized (enlarged to maximum size)
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.
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.
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.