Adding Images to Menu Items
Go Up to Creating Submenus
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:
- Drop a TMainMenu or TPopupMenu object on a form.
- Drop a TImageList object on the form.
- Open the ImageList editor by double clicking on the TImageList object.
- Click Add to select the bitmap or bitmap group you want to use in the menu. Click OK.
- Set the TMainMenu or TPopupMenu object's Images property to the ImageList you just created.
- Create your menu items and submenu items as described in this topic group.
- 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.