How to: Define an Icon for a ToolBar Button Using the Designer


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 Windows Application Project and How to: Add Controls to Windows Forms.


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 Visual Studio Settings.

To set an icon for a toolbar button at design time

  1. Add images to the ImageList component. For more information, see How to: Add or Remove ImageList Images with the Designer.

  2. Select the ToolBar control on your form.

  3. In the Properties window, set the ToolBar control's ImageList property to the ImageList component.

  4. Click the ToolBar control's Buttons property to select it, and click the ellipsis (VisualStudioEllipsesButton screenshot) button to open the ToolBarButton Collection Editor.

  5. Use the Add button to add buttons to the ToolBar control.

  6. 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

Community Additions