[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Menus' (#lcl)

# TMenuItem.GetIconSize

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

## Declaration

Source position: menus.pp line 295

`public function TMenuItem.GetIconSize(`
`ADC: HDC;`
`DPI: Integer = 0`
`):TPoint; virtual;`

## Arguments

`ADC` |  | Device context used to get the display density (PPI) for the glyph images.
`DPI` |  | DPI setting used to scale the icon images retrieved in the method to the monitor where menu item is displayed.

## Function result

TPoint instance with the width and height for the glyph displayed on the menu item.

## Description

The return value is a TPoint instance with the Width (X) and Height (y) for the glyph displayed on the menu item. The return value is an empty TPoint instance if HasIcon returns False.

If HasIcon returns True, GetImageList is called to get the images and their Width. If ImageIndex does not exist in the image list, the method is exited with an empty TPoint instance in the return value.

DPI indicates the Dots Per Inch requested for the icon image. When DPI contains the default value (0), GetDeviceCaps is called to get the logical pixel size for the device context in the ADC argument. The SizeForPPI method in the image list is called to get the size for the scaled image resolution for the DPI value. The size information is stored in the return value.

If an image list has not been assigned to Images or SubMenuImages, the Width and Height values in Bitmap as used in the return value.

GetIconSize is called when a widgetset class renders the menu or menu item to the device context for its window Handle.

## Version info

Modified in LCL version 3.0 to include the DPI argument.