Files
docs-desktop/dotnet-desktop-guide/framework/winforms/controls/toolbar-control-overview-windows-forms.md
T
Andy De George c0ba284473 Initial winforms content migrated (#18)
* Merge winforms framework content to working branch (#14)

* Breadcrumb / TOC / Move net5 to net folder (#15)

* change path from net5 to net

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Add .net 5 winforms placeholder article (#16)

* added some metadata and adjusted net5 placeholder

* corrections

* corrections

* corrections

* Test1

* Swapping landing page vs concept

* fix links

* Fix links

* Fix desc
2020-09-01 16:26:21 -07:00

4.2 KiB

title, ms.date, f1_keywords, helpviewer_keywords, ms.assetid
title ms.date f1_keywords helpviewer_keywords ms.assetid
ToolBar Control Overview 03/30/2017
ToolBar
toolbars [Windows Forms], about toolbars
ToolBar control [Windows Forms], about ToolBar controls
d426b203-0216-4dbe-b834-1641e50a9c29

ToolBar Control Overview (Windows Forms)

Note

The xref:System.Windows.Forms.ToolStrip control replaces and adds functionality to the xref:System.Windows.Forms.ToolBar control; however, the xref:System.Windows.Forms.ToolBar control is retained for both backward compatibility and future use, if you choose.

The Windows Forms xref:System.Windows.Forms.ToolBar control is used on forms as a control bar that displays a row of drop-down menus and bitmapped buttons that activate commands. Thus, clicking a toolbar button can be an equivalent to choosing a menu command. The buttons can be configured to appear and behave as pushbuttons, drop-down menus, or separators. Typically, a toolbar contains buttons and menus that correspond to items in an application's menu structure, providing quick access to an application's most frequently used functions and commands.

Working with the ToolBar Control

A xref:System.Windows.Forms.ToolBar control is usually "docked" along the top of its parent window, but it can also be docked to any side of the window. A toolbar can display tooltips when the user points the mouse pointer at a toolbar button. A ToolTip is a small pop-up window that briefly describes the button or menu's purpose. To display ToolTips, the xref:System.Windows.Forms.ToolBar.ShowToolTips%2A property must be set to true.

Note

Certain applications feature controls very similar to the toolbar that have the ability to "float" above the application window and be repositioned. The Windows Forms ToolBar control is not able to do these actions.

When the xref:System.Windows.Forms.ToolBar.Appearance%2A property is set to xref:System.Windows.Forms.ToolBarAppearance, the toolbar buttons appear raised and three-dimensional. You can set the xref:System.Windows.Forms.ToolBar.Appearance%2A property of the toolbar to xref:System.Windows.Forms.ToolBarAppearance to give the toolbar and its buttons a flat appearance. When the mouse pointer moves over a flat button, the button's appearance changes to three-dimensional. Toolbar buttons can be divided into logical groups by using separators. A separator is a toolbar button with the xref:System.Windows.Forms.ToolBarButton.Style%2A property set to xref:System.Windows.Forms.ToolBarButtonStyle. It appears as empty space on the toolbar. When the toolbar has a flat appearance, button separators appear as lines rather than spaces between the buttons.

The xref:System.Windows.Forms.ToolBar control allows you to create toolbars by adding xref:System.Windows.Forms.Button objects to a xref:System.Windows.Forms.ToolBar.Buttons%2A collection. You can use the Collection Editor to add buttons to a xref:System.Windows.Forms.ToolBar control; each xref:System.Windows.Forms.Button object should have text or an image assigned, although you can assign both. The image is supplied by an associated ImageList component. At run time, you can add or remove buttons from the xref:System.Windows.Forms.ToolBar.ToolBarButtonCollection using the xref:System.Windows.Forms.ToolBar.ToolBarButtonCollection.Add%2A and xref:System.Windows.Forms.ToolBar.ToolBarButtonCollection.Remove%2A methods. To program the buttons of a xref:System.Windows.Forms.ToolBar, add code to the xref:System.Windows.Forms.ToolBar.ButtonClick events of the xref:System.Windows.Forms.ToolBar, using the xref:System.Windows.Forms.ToolBarButtonClickEventArgs.Button%2A property of the xref:System.Windows.Forms.ToolBarButtonClickEventArgs class to determine which button was clicked.

See also