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

# TCustomListBox.MeasureItem

Gets the height for an item in the list.

## Declaration

Source position: stdctrls.pp line 627

`public procedure TCustomListBox.MeasureItem(`
`Index: Integer;`
`var TheHeight: Integer`
`); virtual;`

## Arguments

`Index` |  | Ordinal position in Items for the string examined in the method.
`TheHeight` |  | The height of the item in pixels, can be changed by the event handler.

## Description

MeasureItem is a procedure used to get the height for an item displayed in the list box control.

Integer is the ordinal position in Items for the value measured in the method.

TheHeight is a variable parameter which contains the calculated height for the text in the item. The value on entry is the text height for the current font calculated using the Canvas for the control. The value returned in TheHeight is assigned to the ItemHeight property when it is a non-zero value.

MeasureItems signals the OnMeasureItem event handler (when assigned) using the arguments passed to the method. An application must implement an object procedure to calculate the height for the requested item using the logic required.

MeasureItem is called when the LM_MeasureItem message is handled for the control.

## See also

TCustomListBox.OnMeasureItem |  | Handler invoked when the height for an item is needed.
TCustomListBox.ItemHeight |  | The default height for an item displayed in the list.
TCustomListBox.Items |  | The list of all items defined in the control.
TCustomListBox.Font |  | The font to be used for text display in this control.
TCustomListBox.Canvas |  | Drawing surface where the control is drawn.