FormStartPosition 列挙体
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

<ComVisibleAttribute(True)> _ Public Enumeration FormStartPosition

メンバ名 | 説明 | |
---|---|---|
CenterParent | フォームは、親フォームの境界内の中央に配置されます。 | |
CenterScreen | フォームは、現在の表示の中央に配置され、フォームのサイズとして指定された大きさになります。 | |
Manual | フォームの位置は、Location プロパティによって決定されます。 | |
WindowsDefaultBounds | フォームは Windows の既定位置に配置され、Windows の既定により決定されている境界を持ちます。 | |
WindowsDefaultLocation | フォームは Windows の既定位置に配置され、フォームのサイズとして指定された大きさになります。 |

この列挙体は、Form クラスの StartPosition プロパティで使用されます。この列挙体はフォームのさまざまな開始位置を表します。既定の開始位置は WindowsDefaultLocation です。

この例では、フォームの開始位置を画面の中央に変更し、ラベルを使用して位置情報を表示します。この例は、Form1 という名前の Form が既に作成されていることを前提にしています。
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

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- FormStartPosition 列挙体のページへのリンク