Adding Icons to Menus and Toolbars

From RAD Studio
Jump to: navigation, search

Go Up to Handling VCL Actions Using an Action Manager

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:

  1. Drop an ImageList component from the Win32 category of the Tool palette onto a form.
  2. 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.)
  3. From the Additional category of the Tool palette, drop one or more of the following action bands onto the form:
  4. 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.
  5. 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.
  6. Drag and drop single actions or categories of actions from the Action Manager editor onto the menu or toolbar.
  7. 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.
  8. The images automatically appear on the menu or toolbar.

See Also