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

TCustomColorBox.DrawItem

Draws an item in the combo-box control.

Declaration

Source position: colorbox.pas line 70

protected procedure TCustomColorBox.DrawItem(

  Index: Integer;

  Rect: TRect;

  State: TOwnerDrawState

); override;

Arguments

Index

  

Ordinal position for the item drawn in the method.

Rect

  

Rectangle with the bounds for the item.

State

  

Owner draw state for the item.

Description

DrawItem is an overridden method used to custom draw an item in the ColorBox.

A color preview is drawn using the value in Colors. For clNone and clDefault, the value in NoneColorColor and DefaultColorColor are used to draw the color preview. The value in State is updated to include odBackgroundPainted in the state flags.

The item rectangle is made smaller and passed to the inherited method to draw the text for the item.

The Brush color and Pen color for the control Canvas are reset to their original values after drawing the item.

See also

TCustomComboBox.DrawItem

  

Draws a list item, using the OnDrawItem handler (when assigned).


Version 4.0 Generated 2025-05-03 Home