TVirtualStringTree.OnPaintText Event

Virtual Tree View

Event to change text formatting for particular nodes.

Pascal
property OnPaintText: TVTPaintText;
Description

Write an event handler for this event to render nodes with different fonts, font sizes, styles or colors. According to the parameters each column of each node and even normal and static text can be painted in different ways.

Notes

The string tree view manages an internal width for each node's main column. This is done because computing this width is 

quite costly and the width is needed on several occasions. If you change the font which is used to paint a node's text, 

for example to bold face style, its width changes but the tree view does not know this - it still relies on its cached 

node width. This may result in cut off selection rectangles among others. 

Hence if the width of a node changes after its initialization because it is now formatted differently than before force a 

recalculation of the node width by calling InvalidateNode (when the conditions for the changed formatting are met - not 

in the event handler for OnPaintText).

See Also
Class
Links
What do you think about this topic? Send feedback!