英語で読む

次の方法で共有


FormStartPosition 列挙型

定義

フォームの初期位置を指定します。

C#
[System.Runtime.InteropServices.ComVisible(true)]
public enum FormStartPosition
C#
public enum FormStartPosition
継承
FormStartPosition
属性

フィールド

CenterParent 4

フォームは、親フォームの境界内の中央に配置されます。

CenterScreen 1

フォームは、現在の表示の中央に配置され、フォームのサイズとして指定された大きさになります。

Manual 0

フォームの位置は、Location プロパティによって決定されます。

WindowsDefaultBounds 3

フォームは Windows の既定位置に配置され、Windows の既定により決定されている境界を持ちます。

WindowsDefaultLocation 2

フォームは Windows の既定位置に配置され、フォームのサイズとして指定された大きさになります。

この例では、フォームの開始位置を画面の中央に変更し、ラベルを使用して位置情報を表示します。 この例では、既に Form 名前付き Form1.

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);

    // Moves the start position to the center of the screen.
    StartPosition = FormStartPosition.CenterScreen;
    // Displays the position information.
    label1.Text = "The start position is " + StartPosition;	
}

注釈

この列挙型は、クラスのStartPositionFormプロパティによって使用されます。 フォームのさまざまな開始位置を表します。 既定の開始位置は WindowsDefaultLocation.

適用対象

製品 バージョン
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
Windows Desktop 3.0, 3.1, 5, 6, 7

こちらもご覧ください