Sign in Join
FPDoc Onlineexperiment

TCustomTreeView.CustomDrawItem function

Member of TCustomTreeViewprotectedIn unit ComCtrls

Performs custom drawing for a tree node using the event handlers in the control.

Declaration

pascal
function CustomDrawItem(Node: TTreeNode; State: TCustomDrawState; 
 Stage: TCustomDrawStage; 
 var PaintImages: Boolean): Boolean; virtual

Arguments

Node

Tree node drawn in the method.

State

State for the tree node (selected, focused, disabled, et. al.).

Stage

Drawing stage for the tree view item. cdPrePaint allows the OnCustomDrawItem event handler to be signalled.

PaintImagesTrue if images should be drawn in the OnAdvancedCustomDrawItem event handler.

Function result

True if default drawing needs to be performed in the tree view control.

Description

CustomDrawItem is a Boolean function used to perform custom drawing for the specified tree node using the event handlers for the control.

The OnCustomDrawItem and OnAdvancedCustomDrawItem event handlers are signalled to perform the custom drawing actions needed for the tree node. OnCustomDrawItem is signalled (when assigned) only when Stage contains the value cdPrePaint. OnCustomDrawItem is signalled (when assigned) for any of the values in the TCustomDrawStage enumeration.

State denotes one of Selected, Grayed, Disabled, Checked, Focused, Default, Hot, Marked or Indeterminate.

If PaintImages is True, images should be painted as well as text in the event handler routine.

The return value indicates whether default drawing for the tree node needs to be performed in the tree view control. True indicates that the control is responsible for default drawing, and the event handlers did not perform the action. False indicates that a handler routine performed default drawing, and it can be skipped in the tree view control.

CustomDrawItem is called from the DoPaintNode method. It occurs after StateImages, drawing state, and the display rectangle for the tree node has been determined.

See CustomDraw for the actions performed when drawing the entire tree view control.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.