RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TListView.OnAdvancedCustomDrawItem Event

Occurs at discrete stages during the painting of an item in an owner-draw list view.

Pascal
property OnAdvancedCustomDrawItem: TLVAdvancedCustomDrawItemEvent;
C++
__property TLVAdvancedCustomDrawItemEvent OnAdvancedCustomDrawItem;

Write an OnAdvancedCustomDrawItem event handler to customize the drawing of individual items on the list view's canvas (using the Canvas property). OnAdvancedCustomDrawItem occurs at various stages in the rendering of a list item.  

Unlike the OnDrawItem event, the list view receives this event even if the OwnerDraw property is false. The OnAdvancedCustomDrawItem event handler provides slightly different state information than the OnDrawItem event and occurs after the default rendering as well as before. 

Sender is the list view whose item is drawn. 

Item is the item that is currently being painted. 

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. 

Stage indicates the current stage in drawing the list item. Note that the cdPreErase and cdPostErase stages do not receive event notification. The background must be drawn when the item is rendered. 

DefaultDraw is used only when Stage is cdPrePaint. 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: OnAdvancedCustomDrawItem occurs at various stages during the paint process. If you are only writing code to execute immediately prior to rendering the list item, it is more efficient to use the OnCustomDrawItem event.
 

 

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