BoundsSpecified BoundsSpecified BoundsSpecified BoundsSpecified Enum

定義

指定當定義控制項的大小和位置時,所要使用之控制項的邊界。Specifies the bounds of the control to use when defining a control's size and position.

此列舉具有 FlagsAttribute 個屬性允許以位元方式合併其成員值。

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

欄位

All All All All 15

指定 LocationSize 屬性值均為已定義。Specifies that both the Location and Size property values are defined.

Height Height Height Height 8

指定控制項的高度為已定義。Specifies that the height of the control is defined.

Location Location Location Location 3

指定控制項的 XY 座標均為已定義。Specifies that both the X and Y coordinates of the control are defined.

None None None None 0

未指定邊界。No bounds are specified.

Size Size Size Size 12

指定控制項的 WidthHeight屬性值均為已定義。Specifies that both the Width and Height property values of the control are defined.

Width Width Width Width 4

指定控制項的寬度為已定義。Specifies that the width of the control is defined.

X X X X 1

指定控制項的左邊緣為已定義。Specifies that the left edge of the control is defined.

Y Y Y Y 2

指定控制項的頂端邊緣為已定義。Specifies that the top edge of the control is defined.

範例

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 Control類別的和SetBounds方法時, 請使用這個列舉的成員。Use the members of this enumeration when calling the SetBoundsCore and SetBounds methods of the Control class.

適用於

另請參閱