Form.WindowState Propriété

Définition

Obtient ou définit une valeur qui indique si un formulaire est réduit, agrandi ou normal.

public:
 property System::Windows::Forms::FormWindowState WindowState { System::Windows::Forms::FormWindowState get(); void set(System::Windows::Forms::FormWindowState value); };
public System.Windows.Forms.FormWindowState WindowState { get; set; }
member this.WindowState : System.Windows.Forms.FormWindowState with get, set
Public Property WindowState As FormWindowState

Valeur de propriété

FormWindowState

FormWindowState qui indique si le formulaire est réduit, agrandi ou normal. La valeur par défaut est FormWindowState.Normal.

Exceptions

La valeur spécifiée ne figure pas dans la plage des valeurs valides.

Exemples

L’exemple suivant montre comment définir la WindowState valeur à agrandir. Le code est appelé à partir du Shown gestionnaire d’événements après la création du formulaire.

private void Form1_Shown(object sender, EventArgs e)  
        {  
            this.WindowState = System.Windows.Forms.FormWindowState.Maximized;  
        }  
Private  Sub Form1_Shown(ByVal sender As Object, ByVal e As EventArgs)  
            Me.WindowState = System.Windows.Forms.FormWindowState.Maximized  
End Sub  

Remarques

Avant l’affichage d’un formulaire, la WindowState propriété est toujours définie FormWindowState.Normalsur , quel que soit son paramètre initial. Cela est reflété dans les paramètres de Heightpropriété , Leftet Width Toples paramètres. Si un formulaire est masqué après l’affichage, ces propriétés reflètent l’état précédent jusqu’à ce que le formulaire soit affiché à nouveau, quelles que soient les modifications apportées à la WindowState propriété.

S’applique à

Voir aussi