Freigeben über


ToolBarButtonStyle-Enumeration

Gibt das Schaltflächenformat in einer Symbolleiste an.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

Syntax

'Declaration
Public Enumeration ToolBarButtonStyle
'Usage
Dim instance As ToolBarButtonStyle
public enum ToolBarButtonStyle
public enum class ToolBarButtonStyle
public enum ToolBarButtonStyle
public enum ToolBarButtonStyle

Member

  Membername Beschreibung
Unterstützt von .NET Compact Framework DropDownButton Ein Dropdown-Steuerelement, in dem ein Menü oder ein anderes Fenster angezeigt wird, wenn auf das Steuerelement geklickt wird. 
Unterstützt von .NET Compact Framework PushButton Eine dreidimensionale Standardschaltfläche. 
Unterstützt von .NET Compact Framework Separator Ein Zwischenraum oder eine Linie zwischen Symbolleisten-Schaltflächen. Die Darstellung hängt vom Wert der Appearance-Eigenschaft ab. 
Unterstützt von .NET Compact Framework ToggleButton Eine An-Aus-Schaltfläche, die vertieft dargestellt wird, wenn darauf geklickt wird. Diese Darstellung bleibt solange erhalten, bis erneut auf die Schaltfläche geklickt wird. 

Hinweise

Diese Enumeration wird von Membern wie ToolBarButton.Style verwendet.

Die Darstellung der Symbolleisten-Schaltfläche wird von der Appearance-Eigenschaft der Symbolleiste bestimmt. Wenn die Appearance-Eigenschaft der Symbolleiste auf Flat festgelegt ist, werden die Symbolleiste und die entsprechenden Schaltflächen flach dargestellt. Sobald sich der Mauszeiger über den Schaltflächen befindet, werden diese dreidimensional dargestellt. Schaltflächen-Trennlinien werden bei einer flachen Symbolleistendarstellung als Linien und nicht als Zwischenräume zwischen den Schaltflächen angezeigt.

Beispiel

Im folgenden Beispiel werden ein ToolBar-Steuerelement und drei ToolBarButton-Steuerelemente instanziiert, die Schaltflächen der Symbolleiste zugewiesen und einige der allgemeinen Eigenschaften der Schaltflächen festgelegt. In diesem Code wird davon ausgegangen, dass MenuItem, ImageList, ToolTip und Form instanziiert wurden und der ImageList mindestens ein Image zugewiesen wurde.

Public Sub InitializeMyToolBar()
    ' Create the ToolBar, ToolBarButton controls, and menus.
    Dim toolBarButton1 As New ToolBarButton("Open")
    Dim toolBarButton2 As New ToolBarButton()
    Dim toolBarButton3 As New ToolBarButton()
    Dim toolBar1 As New ToolBar()
Dim menuItem1 As New MenuItem("Print")
Dim contextMenu1 As New ContextMenu(New MenuItem(){menuItem1})
    
    ' Add the ToolBarButton controls to the ToolBar.
    toolBar1.Buttons.Add(toolBarButton1)
    toolBar1.Buttons.Add(toolBarButton2)
    toolBar1.Buttons.Add(toolBarButton3)
    
    ' Assign an ImageList to the ToolBar and show ToolTips.
    toolBar1.ImageList = imageList1
    toolBar1.ShowToolTips = True
    
    ' Assign ImageIndex, ContextMenu, Text, ToolTip, and
    ' Style properties of the ToolBarButton controls. 
    toolBarButton2.Style = ToolBarButtonStyle.Separator
    toolBarButton3.Text = "Print"
    toolBarButton3.Style = ToolBarButtonStyle.DropDownButton
    toolBarButton3.ToolTipText = "Print"
    toolBarButton3.ImageIndex = 0
    toolBarButton3.DropDownMenu = contextMenu1
    
    ' Add the ToolBar to a form.
    Controls.Add(toolBar1)
End Sub
public void InitializeMyToolBar()
 {
    // Create the ToolBar, ToolBarButton controls, and menus.
    ToolBarButton toolBarButton1 = new ToolBarButton("Open");
    ToolBarButton toolBarButton2 = new ToolBarButton();
    ToolBarButton toolBarButton3 = new ToolBarButton();
    ToolBar toolBar1 = new ToolBar();
    MenuItem menuItem1 = new MenuItem("Print");
    ContextMenu contextMenu1 = new ContextMenu(new MenuItem[]{menuItem1});

     
    // Add the ToolBarButton controls to the ToolBar.
    toolBar1.Buttons.Add(toolBarButton1);
    toolBar1.Buttons.Add(toolBarButton2);
    toolBar1.Buttons.Add(toolBarButton3);
 
    // Assign an ImageList to the ToolBar and show ToolTips.
    toolBar1.ImageList = imageList1;
    toolBar1.ShowToolTips = true;
 
    /* Assign ImageIndex, ContextMenu, Text, ToolTip, and 
       Style properties of the ToolBarButton controls. */
    toolBarButton2.Style = ToolBarButtonStyle.Separator;
    toolBarButton3.Text = "Print";
    toolBarButton3.Style = ToolBarButtonStyle.DropDownButton;
    toolBarButton3.ToolTipText = "Print";
    toolBarButton3.ImageIndex = 0;
    toolBarButton3.DropDownMenu = contextMenu1;
 
    // Add the ToolBar to a form.
    Controls.Add(toolBar1);
 }
 
public:
   void InitializeMyToolBar()
   {
      // Create the ToolBar, ToolBarButton controls, and menus.
      ToolBarButton^ toolBarButton1 = gcnew ToolBarButton( "Open" );
      ToolBarButton^ toolBarButton2 = gcnew ToolBarButton;
      ToolBarButton^ toolBarButton3 = gcnew ToolBarButton;
      ToolBar^ toolBar1 = gcnew ToolBar;
      MenuItem^ menuItem1 = gcnew MenuItem( "Print" );
      array<MenuItem^>^ temp1 = {menuItem1};
      System::Windows::Forms::ContextMenu^ contextMenu1 =
         gcnew System::Windows::Forms::ContextMenu( temp1 );
      
      // Add the ToolBarButton controls to the ToolBar.
      toolBar1->Buttons->Add( toolBarButton1 );
      toolBar1->Buttons->Add( toolBarButton2 );
      toolBar1->Buttons->Add( toolBarButton3 );
      
      // Assign an ImageList to the ToolBar and show ToolTips.
      toolBar1->ImageList = imageList1;
      toolBar1->ShowToolTips = true;
      
      /* Assign ImageIndex, ContextMenu, Text, ToolTip, and 
         Style properties of the ToolBarButton controls. */
      toolBarButton2->Style = ToolBarButtonStyle::Separator;
      toolBarButton3->Text = "Print";
      toolBarButton3->Style = ToolBarButtonStyle::DropDownButton;
      toolBarButton3->ToolTipText = "Print";
      toolBarButton3->ImageIndex = 0;
      toolBarButton3->DropDownMenu = contextMenu1;
      
      // Add the ToolBar to a form.
      Controls->Add( toolBar1 );
   }
public void InitializeMyToolBar()
{
    // Create the ToolBar, ToolBarButton controls, and menus.
    ToolBarButton toolBarButton1 = new ToolBarButton("Open");
    ToolBarButton toolBarButton2 = new ToolBarButton();
    ToolBarButton toolBarButton3 = new ToolBarButton();
    ToolBar toolBar1 = new ToolBar();
    MenuItem menuItem1 = new MenuItem("Print");
    ContextMenu contextMenu1 = new ContextMenu(new MenuItem[] {menuItem1});

    // Add the ToolBarButton controls to the ToolBar.
    toolBar1.get_Buttons().Add(toolBarButton1);
    toolBar1.get_Buttons().Add(toolBarButton2);
    toolBar1.get_Buttons().Add(toolBarButton3);

    // Assign an ImageList to the ToolBar and show ToolTips.
    toolBar1.set_ImageList(imageList1);
    toolBar1.set_ShowToolTips(true);

    /* Assign ImageIndex, ContextMenu, Text, ToolTip, and 
     * Style properties of the ToolBarButton controls. 
     */
    toolBarButton2.set_Style(ToolBarButtonStyle.Separator);
    toolBarButton3.set_Text("Print");
    toolBarButton3.set_Style(ToolBarButtonStyle.DropDownButton);
    toolBarButton3.set_ToolTipText("Print");
    toolBarButton3.set_ImageIndex(0);
    toolBarButton3.set_DropDownMenu(contextMenu1);

    // Add the ToolBar to a form.
    get_Controls().Add(toolBar1);
} //InitializeMyToolBar

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0, 1.0

Siehe auch

Referenz

System.Windows.Forms-Namespace
ToolBarAppearance-Enumeration
ToolBar-Klasse