Skip to main content

TcxCustomListView.OnAdvancedCustomDrawItem Event

Enables you to paint items of the list view control before or after default painting takes place.

Declaration

property OnAdvancedCustomDrawItem: TLVAdvancedCustomDrawItemEvent read; write;

Remarks

The OnAdvancedCustomDrawItem event fires for each individual item of the control before and after its default painting takes place. The Stage parameter enables you to identify whether item painting is about to be performed or has been completed.

If the Stage parameter returns the cdPrePaint value, item painting has not been performed yet. In this case you may perform your own painting of the processed item and set the DefaultDraw parameter to False. This value of the DefaultDraw parameter implies that default painting of the processed item will not be performed. Note that if you only need to perform painting before the default drawing routine is executed, you should handle the OnCustomDrawItem event instead. This event fires twice as little times as the OnAdvancedCustomDrawItem event, which results in a performance benefit.

If the Stage parameter returns the cdPostPaint value, item painting has already been finished. At this time, you may perform any additional painting you like. For instance, you can paint a stop sign over the item’s image. Note that the DefaultDraw parameter is not in effect when the Stage parameter value is cdPostPaint. The reason is that no other painting will take place further anyway.

The Sender parameter of the event specifies the control whose item is being painted. Use the Canvas property of the object representing this parameter to obtain the canvas used to paint. The Item parameter enables you to determine the currently processed item. Use it to get the bounding rectangle of the item (the DisplayRect method) and other information needed when painting (caption text, image indexes, etc). The State parameter can be used to determine the state of the painted item. The cdsSelected and cdsHot values included into this parameter’s value indicate that the item is selected or hot-tracked respectively.

See Also