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

# TCustomListBox.DrawItem

Paints an item in owner-draw mode.

## Declaration

Source position: stdctrls.pp line 605

`protected procedure TCustomListBox.DrawItem(`
`Index: Integer;`
`ARect: TRect;`
`State: TOwnerDrawState`
`); virtual;`

## Arguments

`Index` |  | Ordinal position for the item drawn in the method.
`ARect` |  | Canvas rectangle with the coordinate for the drawing operation.
`State` |  | Drawing state for the item.

## Description

DrawItem is a procedure used to render an item in the list box control using the owner-draw mode.

Item contains the ordinal position in Items for the item drawn in the method.

ARect is a TRect instance with the canvas coordinates where the drawing operation is performed.

State contains the drawing state for the owner-drawn item.

DrawItem signals the OnDrawItem event handler (when assigned). An internal default drawing method is used when the event handler has not been implemented.

DrawItem is called when the LM_DrawListItem message is handled for the control.

## See also

TCustomListBox.OnDrawItem |  | Handler for painting of a list item in owner-draw mode.
TCustomListBox.Canvas |  | Drawing surface where the control is drawn.
TDrawItemEvent |  | Specifies an event handler used to paint a single item in an owner-drawn list box or combo-box.