Skip to main content

TcxCustomComboBoxProperties.OnDrawItem Event

Allows you to custom draw a combo box item.

Declaration

property OnDrawItem: TcxEditDrawItemEvent read; write;

Remarks

Handle this event to perform custom draw of items in the combo box and MRU editors. If you handle the OnDrawItem event, the combo box editor will not draw any item.

The event occurs every time an item should be redrawn. The currently painted item is addressed by the AIndex parameter defining the position of the item in the Items list. Use the Items property to access the text that should be displayed.

The editor itself is passed as the AControl parameter.

The AState parameter represents a set of options specifying the manner in which an item should be drawn. For instance, set the odSelected option to draw a selected item.

The graphic surface and bounds for drawing are passed as ACanvas and ARect respectively.

You can use the DropDownWidth and ItemHeight properties to specify the width of the dropdown window and the height of items respectively. If ItemHeight is set to 0 (default), the height of items is calculated automatically based on current font settings.

If you need to change the height of individual items, handle the OnMeasureItem event. This event is raised before OnDrawItem.

See Also