Unit 'Menus' Package
[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] [#lcl]

TMenuItem.Bitmap

Bitmap image (glyph) displayed for the menu item.

Declaration

Source position: menus.pp line 332

published property TMenuItem.Bitmap : TBitmap
  read GetBitmap
  write SetBitmap
  stored IsBitmapStored;

Description

Bitmap is a TBitmap property which contains the bitmap image displayed as a glyph for the menu item.

The value in Bitmap can be set by assigning a TBitmap instance to the property. It may also be retrieved from images in the parent menu (or an Action list) using the ImageIndex property. The assignment mechanisms are not used at the same time. A value assigned directly to the Bitmap property overrides the setting in ImageIndex.

When loading the bitmap in the property using ImageIndex, the image width and height are automatically scaled (when needed) using the canvas scaling factor for the active screen form.

Changing the value in Bitmap causes the UpdateWSIcon method to be called to post the change to the widgetset class. The MenuChanged method is called to signal the OnChange event handler (when assigned).

Use GlyphShowMode to control use the visibility of the glyph image for the menu item.

Version info

Modified in LCL version 4.4 to scale a bitmap (when needed) when loaded using ImageIndex instead of an image directly assigned to the menu item. Fixes an issue for Retina displays on macOS - but it applies to any high DPI display.

See also

TMenuItem.HasBitmap

  

Indicates whether a TBitmap instance has been assigned to the Bitmap property.

TMenuItem.ImageIndex

  

Ordinal position in the list of images for the glyph displayed on the menu item.

TMenuItem.Parent

  

The parent menu item for the class instance.

TMenuItem.GetIconSize

  

Gets the size for the icon (glyph) when used on the menu item.

TMenuItem.GetImageList

  

Gets an image list with the available bitmaps for the menu item.

TMenuItem.GlyphShowMode

  

Indicates the display behavior for the glyph (or Bitmap) on the menu item.

TMenuItem.UpdateWSIcon

  

Updates the widgetset class with the values in HasIcon and Bitmap.


Version 4.4 Generated 2025-11-08 Home