Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
Panel Class
Panel Properties
 BorderStyle Property

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.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)
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.
ExceptionCondition
InvalidEnumArgumentException

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

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.

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

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.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker