BoundsSpecified 列舉

定義

指定當定義控制項的大小和位置時,所要使用之控制項的邊界。

此列舉支援其成員值的位元組合。

public enum class BoundsSpecified
[System.Flags]
public enum BoundsSpecified
[<System.Flags>]
type BoundsSpecified = 
Public Enum BoundsSpecified
繼承
BoundsSpecified
屬性

欄位

All 15

指定 LocationSize 屬性值均為已定義。

Height 8

指定控制項的高度為已定義。

Location 3

指定控制項的 XY 座標均為已定義。

None 0

未指定邊界。

Size 12

指定控制項的 WidthHeight屬性值均為已定義。

Width 4

指定控制項的寬度為已定義。

X 1

指定控制項的左邊緣為已定義。

Y 2

指定控制項的頂端邊緣為已定義。

範例

private:
   void MyForm_Layout( Object^ /*sender*/, System::Windows::Forms::LayoutEventArgs^ /*e*/ )
   {
      // Center the Form on the user's screen everytime it requires a Layout.
      this->SetBounds( (Screen::GetBounds( this ).Width / 2) - (this->Width / 2), (Screen::GetBounds( this ).Height / 2) - (this->Height / 2), this->Width, this->Height, BoundsSpecified::Location );
   }
private void MyForm_Layout(object sender, System.Windows.Forms.LayoutEventArgs e)
{
   // Center the Form on the user's screen everytime it requires a Layout.
   this.SetBounds((Screen.GetBounds(this).Width/2) - (this.Width/2),
       (Screen.GetBounds(this).Height/2) - (this.Height/2),
       this.Width, this.Height, BoundsSpecified.Location);	
}

Private Sub MyForm_Layout(ByVal sender As Object, _
    ByVal e As System.Windows.Forms.LayoutEventArgs) Handles MyBase.Layout

    ' Center the Form on the user's screen everytime it requires a Layout.
    Me.SetBounds((System.Windows.Forms.Screen.GetBounds(Me).Width / 2) - (Me.Width / 2), _
        (System.Windows.Forms.Screen.GetBounds(Me).Height / 2) - (Me.Height / 2), _
        Me.Width, Me.Height, System.Windows.Forms.BoundsSpecified.Location)
End Sub

備註

呼叫 SetBoundsCore 類別的 ControlSetBounds 方法時,請使用這個列舉的成員。

適用於

另請參閱