TCustomTreeView.DoPaint procedure
Implements the Paint method for the control.
Declaration
procedure DoPaint; virtualDescription
DoPaint is a method used to render the control to its
Canvas. It implements the overridden
Paint method for
the control. DoPaint performs the multi-stage drawing process for the control
and its tree nodes using the display rectangle in
ClientRect. The
Color for the control is used as the Brush color on the Canvas.
DoPaint updates the values in the States property to reflect the
drawing state for the control. It includes the value tvsPainting in
the States property to indicate that the Paint method is active. No actions
are performed in the method if tvsPainting has already been
included (Paint has already been called). tvoFocusedPainting is
included in States when Focused is True, and excluded when
Focused is False.
The UpdateDefaultItemHeight method is called when tvoAutoItemHeight
is included in the Options for the control. The existing value in
DefaultItemHeight is used if the option value is omitted.
If the control is custom-drawn, the CustomDraw method is called to
signal assigned event handlers used for the cdPrePaint drawing
stage. Any change to the Canvas brush color in the event handlers is retained
for subsequent use in the method. If the event handlers do not handle drawing
for the cdPrePaint drawing stage, no additional actions are performed in the
method.
See IsCustomDrawn for information about the custom draw event
handlers and their use for specific drawing stages.
DoPaint draws the nodes on the tree view starting at the node in
TopItem. If a given 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,
BottomItem) is reached, or the drawing area is filled.
An InsertMark is drawn for the root node when needed.
Unused space on the client rectangle between on the control borders is filled
with the background color for the control. Borders are drawn for the control
using the value in BorderWidth. clGray, clLtGray, and clWhite are
used as Pen colors to simulate a 3D edge on the control. clBlack is used as
the Pen color for the half-width line drawn using the mid-point for the border.
If the control is custom-drawn, the CustomDraw method is called
again to signal assigned event handlers used for the cdPostPaint
drawing stage. If the event handlers do not perform drawing for the
cdPostPaint drawing stage, no additional actions are performed in the method.
tvsPainting is excluded from the States property prior to exiting
from the method.
Modified in LCL version 5.0 to retain changes to the Brush color in custom draw event handlers.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
