.NET Framework Class Library
Panel..::.BorderStyle Property

Indicates the border style for the control.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)
Syntax

Visual Basic (Declaration)
Public Property BorderStyle As BorderStyle
Visual Basic (Usage)
Dim instance As Panel
Dim value As BorderStyle

value = instance.BorderStyle

instance.BorderStyle = value
C#
public BorderStyle BorderStyle { get; set; }
Visual C++
public:
property BorderStyle BorderStyle {
    BorderStyle get ();
    void set (BorderStyle value);
}
JScript
public function get BorderStyle () : BorderStyle
public function set BorderStyle (value : BorderStyle)

Property Value

Type: System.Windows.Forms..::.BorderStyle
One of the BorderStyle values. The default is BorderStyle.None.
Exceptions

ExceptionCondition
InvalidEnumArgumentException

The specified value when setting this property is not a valid BorderStyle value.

Remarks

By default, the Panel control is displayed without a border. You can use this property to distinguish the boundaries of the Panel control from other areas on the form.

Examples

The following code example creates a Panel control with a three-dimensional border.

Visual Basic
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

C#
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;
}

Visual C++
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;
   }
Platforms

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Version Information

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
See Also

Reference

Tags :


Page view tracker