[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'ComCtrls' (#lcl)

# TCustomTreeView.OnCustomDraw

Event handler signalled to perform custom drawing for the tree view control.

## Declaration

Source position: comctrls.pp line 3676

`protected property TCustomTreeView.OnCustomDraw : TTVCustomDrawEvent read FOnCustomDraw write FOnCustomDraw;`

## Description

OnCustomDraw is a TTVCustomDrawEvent property with the event handler signalled to perform custom drawing for the tree view control. It is signalled (when assigned) from the CustomDraw method, and is used to perform custom drawing for the control in the cdPrePaint drawing stage. It occurs during execution of the Paint method.

An application can implement OnCustomDraw to perform custom drawing for the overall control including borders and decorations not related to nodes on the tree view control.

Arguments to the event handler include:

Sender
  The tree view control for the event notification.
ARect
  The TRect instance with the bounds for the control on its canvas.
DefaultDraw
  Boolean variable argument which indicates if Paint processing should be continued on return from the handler routine. Set DefaultDraw to True in the handler routine to enable drawing of the tree nodes, fold indicators, insert marks, and the unused area on the control. Set DefaultDraw to False to exit the paint process.

The handler routine should use the Canvas for the control to perform drawing operations on the specified bounds rectangle.

Use OnAdvancedCustomDraw to perform additional draw operations needed before the tree nodes on the control is painted.

Use OnCustomDrawItem and OnAdvancedCustomDrawItem to perform custom drawing for tree nodes on the control. Use OnCustomDrawArrow to perform custom drawing for expand/collapse indicators for tree nodes on the control.

## See also

TCustomTreeView.Paint |  | Renders the tree view control.
TCustomTreeView.DoPaint |  | Implements the Paint method for the control.
TCustomTreeView.CustomDraw |  | Performs custom drawing using the assigned event handlers for the tree view control.
TCustomTreeView.OnAdvancedCustomDraw |  | Event handler signalled to custom draw the grid control using drawing stages.
TCustomTreeView.OnCustomDrawItem |  | Event handler signalled to custom draw an item (tree node) on the control.
TCustomTreeView.OnAdvancedCustomDrawItem |  | OnAdvancedCustomDrawItem - event handler for advanced custom drawing item.
TCustomTreeView.OnCustomDrawArrow |  | Event handler signalled to custom draw expand / collapse (fold) indicators for a tree node.
TCustomDrawStage |  | TCustomDrawStage a series of constants to define the drawing stages for custom-drawn controls.
TCustomDrawTarget |  | TCustomDrawTarget - enumerated type controlling how a target object is drawn.