ToolBar::BorderStyle Property
.NET Framework (current version)
Gets or sets the border style of the toolbar control.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
public: property BorderStyle BorderStyle { BorderStyle get(); void set(BorderStyle value); }
Property Value
Type: System.Windows.Forms::BorderStyleOne of the BorderStyle values. The default is BorderStyle.None.
| Exception | Condition |
|---|---|
| InvalidEnumArgumentException | The assigned value is not one of the BorderStyle values. |
The ToolBar can take on a sunken, three-dimensional appearance when the BorderStyle property is set to BorderStyle.Fixed3D. To display a flat thin border around the toolbar control, set the BorderStyle property to BorderStyle.FixedSingle.
The following code example creates a ToolBar control, sets some of its common properties, and adds it to a Form. Delegates are also added to the ButtonClick and ButtonDropDown events. This example requires that a ToolBar named toolBar1 and an ImageList named imageList1 have been declared.
void AddToolBar() { // Add a toolbar and set some of its properties. toolBar1 = gcnew ToolBar; toolBar1->Appearance = System::Windows::Forms::ToolBarAppearance::Flat; toolBar1->BorderStyle = System::Windows::Forms::BorderStyle::None; toolBar1->Buttons->Add( this->toolBarButton1 ); toolBar1->ButtonSize = System::Drawing::Size( 24, 24 ); toolBar1->Divider = true; toolBar1->DropDownArrows = true; toolBar1->ImageList = this->imageList1; toolBar1->ShowToolTips = true; toolBar1->Size = System::Drawing::Size( 292, 25 ); toolBar1->TabIndex = 0; toolBar1->TextAlign = System::Windows::Forms::ToolBarTextAlign::Right; toolBar1->Wrappable = false; // Add handlers for the ButtonClick and ButtonDropDown events. toolBar1->ButtonDropDown += gcnew ToolBarButtonClickEventHandler( this, &MyToolBar::toolBar1_ButtonDropDown ); toolBar1->ButtonClick += gcnew ToolBarButtonClickEventHandler( this, &MyToolBar::toolBar1_ButtonClicked ); // Add the toolbar to the form. this->Controls->Add( toolBar1 ); }
.NET Framework
Available since 1.1
Available since 1.1
Show: