FormStartPosition Enumeration

Definition

Gibt die Ausgangsposition eines Formulars an.

public enum class FormStartPosition
[System.Runtime.InteropServices.ComVisible(true)]
public enum FormStartPosition
public enum FormStartPosition
[<System.Runtime.InteropServices.ComVisible(true)>]
type FormStartPosition = 
type FormStartPosition = 
Public Enum FormStartPosition
Vererbung
FormStartPosition
Attribute

Felder

CenterParent 4

Das Formular wird innerhalb des übergeordneten Formulars zentriert.

CenterScreen 1

Das Formular wird in der aktuellen Anzeige zentriert und mit den in der Formulargröße festgelegten Abmessungen angezeigt.

Manual 0

Die Position des Formulars wird von der Location-Eigenschaft bestimmt.

WindowsDefaultBounds 3

Das Formular wird an der Windows-Standardposition positioniert und mit den im Windows-Standard festgelegten Begrenzungen angezeigt.

WindowsDefaultLocation 2

Das Formular wird an der Windows-Standardposition positioniert und mit den in der Formulargröße festgelegten Abmessungen angezeigt.

Beispiele

In diesem Beispiel ändern Sie die Startposition des Formulars in den Mittelpunkt des Bildschirms und zeigen die Positionsinformationen mithilfe einer Bezeichnung an. In diesem Beispiel wird davon ausgegangen, dass Sie bereits einen Form benannten Namen Form1erstellt haben.

public:
   void InitMyForm()
   {
      // Adds a label to the form.
      Label^ label1 = gcnew Label;
      label1->Location = System::Drawing::Point( 54, 128 );
      label1->Name = "label1";
      label1->Size = System::Drawing::Size( 220, 80 );
      label1->Text = "Start position information";
      this->Controls->Add( label1 );
      
      // Moves the start position to the center of the screen.
      StartPosition = FormStartPosition::CenterScreen;
      
      // Displays the position information.
      label1->Text = String::Format( "The start position is {0}", StartPosition );
   }
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);

    // Moves the start position to the center of the screen.
    StartPosition = FormStartPosition.CenterScreen;
    // Displays the position information.
    label1.Text = "The start position is " + StartPosition;	
}
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)
   
   ' Moves the start position to the center of the screen.
   StartPosition = FormStartPosition.CenterScreen
   ' Displays the position information.
   label1.Text = "The start position is " + StartPosition
End Sub

Hinweise

Diese Aufzählung wird von der StartPosition Eigenschaft der Form Klasse verwendet. Es stellt die unterschiedlichen Startpositionen des Formulars dar. Die Standardstartposition ist WindowsDefaultLocation.

Gilt für

Siehe auch