Adding Color, Patterns, or Pictures to Menus, Buttons, and Toolbars

From RAD Studio
Jump to: navigation, search

Go Up to Handling VCL Actions Using an Action Manager


You can use the Background and BackgroundLayout properties to specify a color, pattern, or bitmap to use on a menu item or button. These properties also let you set up a banner the runs up the left or right side of a menu.

You assign backgrounds and layouts to subitems from their action client objects. If you want to set the background of the items in a menu, in the form designer click on the menu item that contains the items. For example, selecting File lets you change the background of items appearing on the File menu. You can assign a color, pattern, or bitmap in the Background property in the Object Inspector.

Use the BackgroundLayout property to describe how to place the background on the element. Colors or images can be placed behind the caption normally, stretched to fit the item area, or tiled in small squares to cover the area.

Items with normal (blNormal), stretched (blStretch), or tiled (blTile) backgrounds are rendered with a transparent background. If you create a banner, the full image is placed on the left (blLeftBanner) or the right (blRightBanner) of the item. You need to make sure it is the correct size because it is not stretched or shrunk to fit.

To change the background of an action band (that is, on a main menu or toolbar), select the action band and choose the TActionClientBar through the action band collection editor. You can set Background and BackgroundLayout properties to specify a color, pattern, or bitmap to use on the entire toolbar or menu.

See Also