RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomListView.OnCustomDrawItem Event

Occurs when an item in an owner-draw list view must be rendered.

Pascal
property OnCustomDrawItem: TLVCustomDrawItemEvent;
C++
__property TLVCustomDrawItemEvent OnCustomDrawItem;

Write code in an OnCustomDrawItem handler to draw individual items on the list view's canvas (using the Canvas property) before an item is painted.  

Unlike the OnDrawItem event, the list view receives this event even if the OwnerDraw property is false. The OnCustomDrawItem event handler provides slightly different state information than the OnDrawItem event.  

Sender is the list view whose item is to be drawn. 

Item is the item that should be rendered. 

State indicates the state of the item, so that the event handler can adjust the image to reflect whether the item is selected, disabled, hot, and so on. 

Set DefaultDraw to false if you don't want the control to paint the item's text after the event handler exits. If DefaultDraw remains true, the list view adds the item's text to the image on the canvas.

Note: OnCustomDrawItem occurs immediately prior to the rendering of each list item. To augment the default drawing process at other stages (such as after the list item is drawn), use the OnAdvancedCustomDrawItem event instead.
 

 

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