BoundsSpecified 枚举

定义

指定在定义控件的大小和位置时要使用的控件边界。

此枚举支持其成员值的按位组合。

C#
[System.Flags]
public enum BoundsSpecified
继承
BoundsSpecified
属性

字段

名称 说明
All 15

指定 LocationSize 属性值都需定义。

Height 8

指定需定义控件的高度。

Location 3

指定控件的 XY 坐标都需定义。

None 0

未定义任何边界。

Size 12

指定控件的 WidthHeight 属性值都需定义。

Width 4

指定需定义控件的宽度。

X 1

指定需定义控件的左边缘。

Y 2

指定需定义控件的上边缘。

示例

C#
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);	
}

注解

调用 SetBoundsCore 类的 和 SetBounds 方法 Control 时,请使用此枚举的成员。

适用于

产品 版本
.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, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

另请参阅