Toolbar in C#
Note: The Toolbar control is not available in Toolbox of Visual Studio 2010 or later versions. The ToolStrip control replaces Toolbar in Visual Studio 2010 or later versions. Please refer to ToolStrip Control In Visual Studio to get started with the ToolStrip control.
If you are using previous versions of Visual Studio, read my article Tutorial: Working with Toolbars in C#.
Creating a Toolbar
Toolbar class represents a Toolbar.
A Toolbar is a combination of Toolbar buttons. ToolBarButton class represents a Toolbar button. The following code snippet creates five buttons and add them to Toolbar.
Now, let's add a Toolbar button click event handler. This handler code will be executed when a button on the Toolbar is clicked.
In the end, we add Toolbar to the Form.
The following code snippet sets these properties and adds three images to the Toolbar control and later loops through the images and displays them on a Form.
In this article, we discussed how to create and use a Toolbar control in a Windows Forms application.