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

# TCustomListBox.OnDrawItem

Handler for painting of a list item in owner-draw mode.

## Declaration

Source position: stdctrls.pp line 652

`public property TCustomListBox.OnDrawItem : TDrawItemEvent read FOnDrawItem write FOnDrawItem;`

## Description

OnDrawItem is a TDrawItemEvent property with the event handler signalled to render a list item when an owner-drawn method is used in the Style property. OnDrawItem is signalled (when assigned) from the DrawItem method. DrawItem provides the arguments for the event handler.

An application should implement an object procedure to respond to the event notification. Use the Canvas for the control to get text metrics or render the control and any graphic images. An internal drawing routine which uses the Font, Color, Layout and Alignment in the control is called when OnDrawItem has not been assigned.

## See also

TCustomListBox.Style |  | Appearance of the list box (standard, owner-draw fixed, or owner-draw variable).
TCustomListBox.DrawItem |  | Paints an item in owner-draw mode.
TCustomListBox.Canvas |  | Drawing surface where the control is drawn.
TCustomListBox.Font |  | The font to be used for text display in this control.
TCustomListBox.Align |  | Specifies the placement of the control on its Parent control.
TListBoxStyle |  | Determines how items are drawn in a list box control.
TDrawItemEvent |  | Specifies an event handler used to paint a single item in an owner-drawn list box or combo-box.
TControl.Color |  | The background color for the control.
TCanvas.TextStyle |  | Text style attributes used to draw text on the canvas.
TTextStyle |  | The Style of the Text to be drawn in a rectangle.