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.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 與表單上的其他區域。

適用於