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

# TCustomComboBox.OnDrawItem

Handler for special painting of an item (in owner-draw mode).

## Declaration

Source position: stdctrls.pp line 399

`protected property TCustomComboBox.OnDrawItem : TDrawItemEvent read FOnDrawItem write FOnDrawItem;`

## Description

OnDrawItem is a TDrawItemEvent property which contains an event handler used to draw an item in the drop-down list for the control. OnDrawItem is used when Style contains one of the owner-drawn values. See TComboBoxStyle for more information about the owner-drawn styles available.

OnDrawItem is signalled (when assigned) from the DrawItem method. The event handler is responsible for all drawing operations needed to render the specified list item. This can include the text and any images or overlays drawn for the list item. Use the Canvas property to render the list item to the specified coordinate rectangle.

If OnDrawItem is not assigned, an internal default drawing routine is called to render the list item. It handles filling the canvas rectangle with the background for the item, and drawing the item text using the style, layout, and alignment defined in the control.

## See also

TCustomComboBox.DrawItem |  | Draws a list item, using the OnDrawItem handler (when assigned).
TCustomComboBox.Style |  | Controls the appearance and behavior for the combo-box.
TCustomComboBox.Canvas |  | Provides access to the drawing surface for the control.
TDrawItemEvent |  | Specifies an event handler used to paint a single item in an owner-drawn list box or combo-box.
TComboBoxStyle |  | The display style available for combo-box controls.