BoundsSpecified 枚举

定义

指定在定义控件的大小和位置时要使用的控件边界。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
继承
BoundsSpecified
属性

字段

All 15

指定 LocationSize 属性值都需定义。Specifies that both the Location and Size property values are defined.

Height 8

指定需定义控件的高度。Specifies that the height of the control is defined.

Location 3

指定控件的 XY 坐标都需定义。Specifies that both the X and Y coordinates of the control are defined.

None 0

未定义任何边界。No bounds are specified.

Size 12

指定控件的 WidthHeight 属性值都需定义。Specifies that both the Width and Height property values of the control are defined.

Width 4

指定需定义控件的宽度。Specifies that the width of the control is defined.

X 1

指定需定义控件的左边缘。Specifies that the left edge of the control is defined.

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.

适用于

另请参阅