Share via


Panel.BorderStyle 属性

指示控件的边框样式。

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

语法

声明
Public Property BorderStyle As BorderStyle
用法
Dim instance As Panel
Dim value As BorderStyle

value = instance.BorderStyle

instance.BorderStyle = value
public BorderStyle BorderStyle { get; set; }
public:
property BorderStyle BorderStyle {
    BorderStyle get ();
    void set (BorderStyle value);
}
/** @property */
public BorderStyle get_BorderStyle ()

/** @property */
public void set_BorderStyle (BorderStyle value)
public function get BorderStyle () : BorderStyle

public function set BorderStyle (value : BorderStyle)

属性值

BorderStyle 值之一。默认为 BorderStyle.None

异常

异常类型 条件

InvalidEnumArgumentException

设置此属性时指定的值不是有效的 BorderStyle 值。

备注

默认情况下,Panel 控件显示时没有边框。可以用这一属性将 Panel 控件的边界与窗体上的其他区域区分开。

示例

下面的代码示例将创建一个带有三维边框的 Panel 控件。

Public Sub CreateMyPanel()
    Dim panel1 As New Panel()
       
    ' Initialize the Panel control.
    panel1.Location = New Point(56, 72)
    panel1.Size = New Size(264, 152)
    ' Set the Borderstyle for the Panel to three-dimensional.
    panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
End Sub
public void CreateMyPanel()
{
   Panel panel1 = new Panel();
   
   // Initialize the Panel control.
   panel1.Location = new Point(56,72);
   panel1.Size = new Size(264, 152);
   // Set the Borderstyle for the Panel to three-dimensional.
   panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
}
public:
   void CreateMyPanel()
   {
      Panel^ panel1 = gcnew Panel;
      
      // Initialize the Panel control.
      panel1->Location = Point(56,72);
      panel1->Size = System::Drawing::Size( 264, 152 );
      // Set the Borderstyle for the Panel to three-dimensional.
      panel1->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D;
   }
public void CreateMyPanel()
{
    Panel panel1 = new Panel();

    // Initialize the Panel control.
    panel1.set_Location(new Point(56, 72));
    panel1.set_Size(new Size(264, 152));

    // Set the Borderstyle for the Panel to three-dimensional.
    panel1.set_BorderStyle(System.Windows.Forms.BorderStyle.Fixed3D);
} //CreateMyPanel

平台

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

请参见

参考

Panel 类
Panel 成员
System.Windows.Forms 命名空间