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

# TCustomTreeView.DoPaint

Implements the Paint method for the control.

## Declaration

Source position: comctrls.pp line 3610

`protected procedure TCustomTreeView.DoPaint; virtual;`

## Description

DoPaint is a method used render the control to its canvas. It Implements the overridden Paint method. No actions are performed in the method when tvsPainting has been included in the States property (Paint has already been called).

DoPaint includes the value tvsPainting in the States property to indicate that the paint method is active. It includes the value tvoFocusedPainting in States when Focused is True, or excludes the value when Focused is False.

The UpdateDefaultItemHeight is called when tvoAutoItemHeight is included in the Options for the control. The existing value in DefaultItemHeight is used when the Option is omitted.

DoPaint performs the multi-stage drawing process for nodes in the tree view control using its Canvas and a display rectangle using the ClientWidth for the control. If the control includes event handlers for the cdPrePaint stage, the CustomDraw method is called.

DoPaint draws the nodes on the tree view starting at the node in TopItem. If the node is Visible, the DoPaintNode method is called to render the tree node. The next visible node in the tree is retrieved, and the process is repeated until no more nodes are available or the drawing area is filled.

An InsertMark is drawn for the root node if needed.

Borders are drawn around the control using the value in BorderWidth.

If the control has event handlers for the cdPostPaint stage, the CustomDraw method is called.

The value tvsPainting is excluded from the States property prior to exit.