Sign in Join
FPDoc Onlineexperiment

TCustomTreeView.OnCustomDraw property

Member of TCustomTreeViewprotectedIn unit ComCtrls

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

Declaration

pascal
property 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

An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.