BoundsSpecified 枚举

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

此枚举有一个 FlagsAttribute 属性,允许其成员值按位组合。

**命名空间:**System.Windows.Forms
**程序集:**System.Windows.Forms(在 system.windows.forms.dll 中)

语法

声明
<FlagsAttribute> _
Public Enumeration BoundsSpecified
用法
Dim instance As BoundsSpecified
[FlagsAttribute] 
public enum BoundsSpecified
[FlagsAttribute] 
public enum class BoundsSpecified
/** @attribute FlagsAttribute() */ 
public enum BoundsSpecified
FlagsAttribute 
public enum BoundsSpecified

成员

  成员名称 说明
由 .NET Compact Framework 支持 All LocationSize 属性值都已定义。 
由 .NET Compact Framework 支持 Height 该控件的高度已定义。 
由 .NET Compact Framework 支持 Location 该控件的 XY 坐标都已定义。 
由 .NET Compact Framework 支持 None 未定义任何边界。 
由 .NET Compact Framework 支持 Size 该控件的 WidthHeight 属性值都已定义。 
由 .NET Compact Framework 支持 Width 该控件的宽度已定义。 
由 .NET Compact Framework 支持 X 该控件的左边缘已定义。 
由 .NET Compact Framework 支持 Y 该控件的上边缘已定义。 

备注

当调用 Control 类的 SetBoundsCoreSetBounds 方法时使用此枚举的成员。

示例

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
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 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).get_Width() 
        / 2 - this.get_Width() / 2, Screen.GetBounds(this).get_Height() 
        / 2 - this.get_Height() / 2, this.get_Width(), this.get_Height(), 
        BoundsSpecified.Location);
} //MyForm_Layout

平台

Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

.NET Compact Framework

受以下版本支持:2.0

请参见

参考

System.Windows.Forms 命名空间
SetBoundsCore
SetBounds
Size
Location