ToolBarButtonStyle Enumeration
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Achtung
ToolBar is provided for binary compatibility with .NET Framework and is not intended to be used directly from your code. Use ToolStrip instead.
Gibt das Schaltflächenformat in einer Symbolleiste an.
public enum class ToolBarButtonStyle
public enum ToolBarButtonStyle
[System.ComponentModel.Browsable(false)]
[System.Obsolete("`ToolBar` is provided for binary compatibility with .NET Framework and is not intended to be used directly from your code. Use `ToolStrip` instead.", false, DiagnosticId="WFDEV006", UrlFormat="https://aka.ms/winforms-warnings/{0}")]
public enum ToolBarButtonStyle
type ToolBarButtonStyle =
[<System.ComponentModel.Browsable(false)>]
[<System.Obsolete("`ToolBar` is provided for binary compatibility with .NET Framework and is not intended to be used directly from your code. Use `ToolStrip` instead.", false, DiagnosticId="WFDEV006", UrlFormat="https://aka.ms/winforms-warnings/{0}")>]
type ToolBarButtonStyle =
Public Enum ToolBarButtonStyle
- Vererbung
- Attribute
Felder
| Name | Wert | Beschreibung |
|---|---|---|
| PushButton | 1 | Eine standardmäßige dreidimensionale Schaltfläche. |
| ToggleButton | 2 | Eine Umschaltfläche, die eingeblendet erscheint, wenn sie geklickt wird, und behält die eingeblendete Darstellung bei, bis sie erneut geklickt wurde. |
| Separator | 3 | Ein Leerzeichen oder eine Linie zwischen Symbolleistenschaltflächen. Die Darstellung hängt vom Wert der Appearance Eigenschaft ab. |
| DropDownButton | 4 | Ein Dropdown-Steuerelement, das ein Menü oder ein anderes Fenster anzeigt, wenn darauf geklickt wird. |
Beispiele
Im folgenden Beispiel werden ein und ToolBar drei ToolBarButton Steuerelemente instanziiert, die Schaltflächen der Symbolleiste zugewiesen und einige der allgemeinen Eigenschaften der Schaltflächen festgelegt. Dieser Code geht davon aus, dass ein MenuItem, ToolTipImageListund eine Form instanziiert wurde und der ImageList ihm mindestens eine Image zugewiesen wurde.
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.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 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
Hinweise
Diese Aufzählung wird von Membern verwendet, z ToolBarButton.Style. B. .
Die Darstellung der Symbolleistenschaltfläche wird durch die Appearance Eigenschaft der Symbolleiste bestimmt. Wenn Sie die Appearance Eigenschaft so festlegen, Flat dass die Symbolleiste und die zugehörigen Schaltflächen eine flache Darstellung erhalten. Während der Mauszeiger über die Schaltflächen bewegt wird, übernehmen sie eine dreidimensionale Darstellung. Wenn die Symbolleiste eine flache Darstellung aufweist, werden Schaltflächentrennzeichen nicht als Leerzeichen zwischen den Schaltflächen, sondern als Linie angezeigt.