RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomColorBox.DrawItem Method

Renders an individual item in the color box.

Pascal
procedure DrawItem(Index: Integer; Rect: TRect; State: TOwnerDrawState); override;
C++
virtual __fastcall DrawItem(int Index, TRect Rect, TOwnerDrawState State);

Applications can't call this protected method. It is called automatically when the color box needs to paint one of the items in the list. DrawItem draws a small box that displays the color that the item represents, followed by the name of the color. 

Index is the index of the item to draw, where 0 specifies the first item, 1 specifies the second item, and so on. 

Rect indicates the boundaries of the item on the color box's canvas, in client coordinates. 

State indicates state information that can affect the way the item is drawn. In TCustomColorBox, DrawItem uses State to determine whether an item is selected, but ignores all other state information. 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!