How to: Define an Icon for a ToolBar Button Using the Designer
Note
The ToolStrip control replaces and adds functionality to the ToolBar control; however, the ToolBar control is retained for both backward compatibility and future use, if you choose.
ToolBar buttons are able to display icons within them for easy identification by users. This is achieved through adding images to the ImageList component and associating it with the ToolBar control.
The following procedure requires a Windows Application project with a form containing a ToolBar control and an ImageList component. For information about setting up such a project, see How to: Create a New Windows Forms Application Project and How to: Add Controls to Windows Forms.
Note
The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Working with Settings.
To set an icon for a toolbar button at design time
Add images to the ImageList component. For more information, see How to: Add or Remove ImageList Images with the Designer.
Select the ToolBar control on your form.
In the Properties window, set the ToolBar control's ImageList property to the ImageList component.
Click the ToolBar control's Buttons property to select it, and click the ellipsis () button to open the ToolBarButton Collection Editor.
Use the Add button to add buttons to the ToolBar control.
In the Properties window that appears in the pane on the right side of the ToolBarButton Collection Editor, set the ImageIndex property of each toolbar button to one of the values in the list, which is drawn from the images you added to the ImageList component.
See Also
Tasks
How to: Trigger Menu Events for Toolbar Buttons