Panel.BorderStyle 属性

定义

指示控件的边框样式。

public:
 property System::Windows::Forms::BorderStyle BorderStyle { System::Windows::Forms::BorderStyle get(); void set(System::Windows::Forms::BorderStyle value); };
public System.Windows.Forms.BorderStyle BorderStyle { get; set; }
member this.BorderStyle : System.Windows.Forms.BorderStyle with get, set
Public Property BorderStyle As BorderStyle

属性值

BorderStyle

BorderStyle 值之一。 默认值为 BorderStyle.None

例外

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

示例

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

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.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 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

注解

默认情况下,控件 Panel 不带边框显示。 可以使用此属性将控件的 Panel 边界与窗体上的其他区域区分开来。

适用于