Name
ToolBarButton
Synopsis
This component represents a button on a ToolBar
.
By default, the Style
is a regular
ToolBarButtonStyle.PushButton
, but you can change
this to a ToolBarButtonStyle.DropDownButton
(displaying a menu or pop-up window when clicked),
ToolBarButtonStyle.ToggleButton
, or
ToolBarButtonStyle.Separator
(dividing line
between the controls).
You can define the Text
it will display and the
ImageIndex
of an image in the
Parent
controls
ToolBar.ImageList
. Note that the position in which
the text will be displayed on the button is determined by the
ToolBar
, not the ToolBarButton
It can be enabled and disabled with the Enabled
property, and you can change the Visible
state.
Toggle buttons can be set Pushed
(or a
tristate-like PartialPush
). Drop-down buttons can
have a DropDownMenu
assigned.
You can also find the bounding Rectangle
of the
button in the parent coordinate space.
public class ToolBarButton : System.ComponentModel.Component { // Public Constructors public ToolBarButton(); public ToolBarButton(string text); // Public Instance Properties public Menu DropDownMenu{set; get; } public bool Enabled{set; get; } public int ImageIndex{set; get; } public ToolBar Parent{get; } public bool PartialPush{set; get; } public bool Pushed{set; get; } public Rectangle Rectangle{get; } public ToolBarButtonStyle Style{set; get; } public object Tag{set; get; } public string Text{set; get; } public string ToolTipText{set; get; } public bool Visible{set; get; } // Public Instance Methods ...
Get .NET Windows Forms in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.