Panel.BorderStyle 属性

定义

指示控件的边框样式。Indicates the border style for the control.

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 值之一。One of the BorderStyle values. 默认值为 BorderStyle.NoneThe default is BorderStyle.None.

异常

当设置此属性时,指定的值不是有效的 BorderStyle 值。The specified value when setting this property is not a valid BorderStyle value.

示例

下面的代码示例创建一个具有三维边框的 Panel 控件。The following code example creates a Panel control with a three-dimensional border.

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 控件在显示时不带边框。By default, the Panel control is displayed without a border. 您可以使用此属性将 Panel 控件的边界与窗体上的其他区域区分开来。You can use this property to distinguish the boundaries of the Panel control from other areas on the form.

适用于