RAD Studio
ContentsIndex
PreviousUpNext
Adding Images to Menu Items

Images can help users navigate in menus by matching glyphs and images to menu item action, similar to toolbar images. You can add single bitmaps to menu items, or you can organize images for your application into an image list and add them to a menu from the image list. If you're using several bitmaps of the same size in your application, it's useful to put them into an image list. 

To add a single image to a menu or menu item, set its Bitmap property to reference the name of the bitmap to use on the menu or menu item.

To add an image to a menu item using an image list:

  1. Drop a TMainMenu or TPopupMenu object on a form.
  2. Drop a TImageList object on the form.
  3. Open the ImageList editor by double clicking on the TImageList object.
  4. Click Add to select the bitmap or bitmap group you want to use in the menu. Click OK.
  5. Set the TMainMenu or TPopupMenu object's Images property to the ImageList you just created.
  6. Create your menu items and submenu items as described in this topic group.
  7. Select the menu item you want to have an image in the Object Inspector and set the ImageIndex property to the corresponding number of the image in the ImageList (the default value for ImageIndex is -1, which doesn't display an image).
Note: Use images that are 16 by 16 pixels for proper display in the menu. Although you can use other sizes for the menu images, alignment and consistency problems may result when using images greater than or smaller than 16 by 16 pixels.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!