Freigeben über


FormStartPosition-Enumeration

Gibt die Ausgangsposition eines Formulars an.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

Syntax

'Declaration
<ComVisibleAttribute(True)> _
Public Enumeration FormStartPosition
'Usage
Dim instance As FormStartPosition
[ComVisibleAttribute(true)] 
public enum FormStartPosition
[ComVisibleAttribute(true)] 
public enum class FormStartPosition
/** @attribute ComVisibleAttribute(true) */ 
public enum FormStartPosition
ComVisibleAttribute(true) 
public enum FormStartPosition

Member

  Membername Beschreibung
CenterParent Das Formular wird innerhalb des übergeordneten Formulars zentriert. 
CenterScreen Das Formular wird in der aktuellen Anzeige zentriert und mit den in der Formulargröße festgelegten Abmessungen angezeigt. 
Manual Die Position des Formulars wird von der Location-Eigenschaft bestimmt. 
WindowsDefaultBounds Das Formular wird an der Windows-Standardposition positioniert und mit den im Windows-Standard festgelegten Begrenzungen angezeigt. 
WindowsDefaultLocation Das Formular wird an der Windows-Standardposition positioniert und mit den in der Formulargröße festgelegten Abmessungen angezeigt. 

Hinweise

Diese Enumeration wird von der StartPosition-Eigenschaft der Form-Klasse verwendet. Sie entspricht den verschiedenen Anfangspositionen des Formulars. Der Standardanfangsposition ist WindowsDefaultLocation.

Beispiel

In diesem Beispiel wird die Anfangsposition des Formulars auf die Mitte des Bildschirms geändert, und es werden die Informationen über die Position mit einem Label-Steuerelement angezeigt. In diesem Beispiel wird davon ausgegangen, dass bereits ein Form mit dem Namen Form1 erstellt wurde.

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 'InitMyForm
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:
   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.set_Location(new System.Drawing.Point(54, 128));
    label1.set_Name("label1");
    label1.set_Size(new System.Drawing.Size(220, 80));
    label1.set_Text("Start position information");
    this.get_Controls().Add(label1);

    // Moves the start position to the center of the screen.
    set_StartPosition(FormStartPosition.CenterScreen);

    // Displays the position information.
    label1.set_Text("The start position is " + get_StartPosition());
} //InitMyForm

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

System.Windows.Forms-Namespace
Form.StartPosition-Eigenschaft