Skip to Content
.NET Windows Forms in a Nutshell
book

.NET Windows Forms in a Nutshell

by Ian Griffiths, Matthew Adams
March 2003
Intermediate to advanced
896 pages
32h 35m
English
O'Reilly Media, Inc.
Content preview from .NET Windows Forms in a Nutshell

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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Windows Forms 2.0 Programming

Windows Forms 2.0 Programming

Chris Sells, Michael Weinhardt
Pro C# 7: With .NET and .NET Core

Pro C# 7: With .NET and .NET Core

Andrew Troelsen, Philip Japikse

Publisher Resources

ISBN: 0596003382Supplemental ContentCatalog PageErrata