Adding Icons to Menus and Toolbars
You can add icons next to menu items or replace captions on toolbars with icons. You organize bitmaps or icons using an ImageList component.
To add icons to menus and toolbars:
- Drop an ImageList component from the Win32 category of the Tool palette onto a form.
- Add the images you want to use to the image list: Double-click the ImageList icon. Click Add and navigate to the images you want to use and click OK when done. Some sample images are included in Program Files\Common Files\Embarcadero Shared\Images. (The buttons images include two views of each for active and inactive buttons.)
- From the Additional category of the Tool palette, drop one or more of the following action bands onto the form:
- TActionMainMenuBar (for designing main menus)
- Vcl.ActnCtrls.TActionToolBar (for designing toolbars)
- Connect the image list to the Action Manager. First, set the focus on the Action Manager. Next, in the Object Inspector, select the name of the image list from the Images property, such as ImageList1.
- Use the Action Manager editor to add actions to the Action Manager. You can associate an image with an action by setting its ImageIndex property to its number in the image list.
- Drag and drop single actions or categories of actions from the Action Manager editor onto the menu or toolbar.
- For toolbars where you only want to display the icon and no caption: select the Toolbar action band and double-click its Items property. In the collection editor, you can select one or more items and set their Caption properties.
- The images automatically appear on the menu or toolbar.