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

# TCustomTreeView.DoPaintNode

Renders the specified tree node to the canvas for the control.

## Declaration

Source position: comctrls.pp line 3610

`protected procedure TCustomTreeView.DoPaintNode(`
`Node: TTreeNode`
`); virtual;`

## Arguments

`Node` |  | Tree node rendered in the method.

## Description

DoPaintNode is a method used to render the tree node specified in Node to the Canvas for the control. DoPaintNode is called from the DoPaint method, and occurs for visible nodes processed in the method. No actions are performed in the method when the Node is not in the visible client area for the control.

DoPaintNode draws the elements which represent a given tree node, including:

- Text for the tree node (when it is not the EditingItem for the control).
- An Image or State Image for the node.
- Expand or Collapse indicators for the node.
- Background for the node using theme services or node state.
- An Insert mark for the initial child node in the tree hierarchy.
- Horizontal and vertical lines used to join nodes in the tree hierarchy.
- The Separator line drawn after a node.

The text color is determined using the Enabled properties in both the tree view control and the tree Node. When theme services are enabled in Options (using tvoThemedDraw), theme element details provide the color and font style for the enabled state. Otherwise, the color value in DisabledFontColor or Font is used.

DoPaintNode retrieves scaled image resolutions needed for the Images and StateImages in the control. The images sizes are determined by applying the scaling factor in Canvas to the current PixelsPerInch setting in Font.

Use of multi-stage custom drawing is supported. If event handlers are provided for the cdPrePaint and cdPostPaint stages, the CustomDraw and CustomDrawItem methods are used to render the node with the drawing state for the node.

## See also

TCustomTreeView.DoPaint |  | Implements the Paint method for the control.
TCustomTreeView.ExpandSignType |  | Sets the drawing style for the expand / collapse (fold/unfold) indicators for tree nodes.
TCustomTreeView.EditingItem |  | Contains the tree node being edited in the control.
TCustomTreeView.CustomDraw |  | Performs custom drawing using the assigned event handlers for the tree view control.
TCustomTreeView.OnCustomDraw |  | Event handler signalled to perform custom drawing for the tree view control.
TCustomTreeView.OnAdvancedCustomDraw |  | Event handler signalled to custom draw the grid control using drawing stages.
TCustomTreeView.CustomDrawItem |  | Performs custom drawing for a tree node using the event handlers in the control.
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.
TCustomControl.Canvas |  | The drawing surface for the control.
TControl.Font |  | The font to be used for text display in this control.