Export (0) Print
Expand All
Expand Minimize

FormWindowState Enumeration

Specifies how a form window is displayed.

[Visual Basic]
<Serializable>
<ComVisible(True)>
Public Enum FormWindowState
[C#]
[Serializable]
[ComVisible(true)]
public enum FormWindowState
[C++]
[Serializable]
[ComVisible(true)]
__value public enum FormWindowState
[JScript]
public
   Serializable
 ComVisible(true)
enum FormWindowState

Remarks

This enumeration is used by the Form class. It represents the different states of the form. The default state is Normal.

Members

Member name Description
Maximized

Supported by the .NET Compact Framework.

A maximized window.
Minimized A minimized window.
Normal

Supported by the .NET Compact Framework.

A default sized window.

Example

[Visual Basic, C#, C++] In this example, you change the form's window state to Maximized and display the state information using a label. This example assumes that you have already created a Form named Form1.

[Visual Basic] 
Public Sub InitMyForm()
   ' Adds a label to the form.
   Dim label1 As New Label()
   label1.Location = New System.Drawing.Point(54, 128)
   label1.Name = "label1"
   label1.Size = New System.Drawing.Size(220, 80)
   label1.Text = "Start Position Information"
   Me.Controls.Add(label1)
   
   ' Changes the windows state to Maximized.
   WindowState = FormWindowState.Maximized
   ' Displays the window information.
   label1.Text = "The Form Window is " + WindowState
End Sub 'InitMyForm

[C#] 
public void InitMyForm()
{
    // Adds a label to the form.
    Label label1 = new Label();
    label1.Location = new System.Drawing.Point(54, 128);
    label1.Name = "label1";
    label1.Size = new System.Drawing.Size(220, 80);
    label1.Text = "Start position information";
    this.Controls.Add(label1);

    // Changes the window state to Maximized.
    WindowState = FormWindowState.Maximized;
    // Displays the state information.
    label1.Text = "The form window is " + WindowState;    
}

[C++] 
public:
    void InitMyForm() {
        // Adds a label to the form.
        Label* label1 = new Label();
        label1->Location = System::Drawing::Point(54, 128);
        label1->Name = S"label1";
        label1->Size = System::Drawing::Size(220, 80);
        label1->Text = S"Start position information";
        this->Controls->Add(label1);

        // Changes the window state to Maximized.
        WindowState = FormWindowState::Maximized;
        // Displays the state information.
        label1->Text = String::Concat(
            S"The form window is ",__box( WindowState));
    }

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: System.Windows.Forms

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

Assembly: System.Windows.Forms (in System.Windows.Forms.dll)

See Also

System.Windows.Forms Namespace

Show:
© 2014 Microsoft