Skip to main content
TeeTree provides powerful custom drawing capabilities, allowing you to extend node rendering with custom graphics, backgrounds, and effects.

Canvas Events

Use BeforeDraw and AfterDraw events to add custom graphics to the tree:

Custom Shape Classes

Create completely custom node shapes by inheriting from TTreeNodeShape:

Using Custom Shape Classes

Set custom shapes as the default node class:

Gradient Backgrounds

Apply gradient fills to nodes:

Custom Polygon Shapes

Define shapes using custom point arrays:

Z-Order Drawing

Control drawing depth with Z-coordinates:

Canvas Properties

The Tree.Canvas object provides:

Drawing Methods

  • Line, LineWithZ - Draw lines
  • Rectangle - Draw rectangles
  • Ellipse - Draw ellipses
  • Polygon - Draw polygons
  • TextOut - Draw text

Style Properties

  • Pen - Line and border styling
  • Brush - Fill styling
  • Font - Text styling
  • AssignBrush, AssignPen - Apply styles

Performance Tips

  • Minimize calculations in Draw method
  • Cache frequently used values
  • Use BeginUpdate/EndUpdate when modifying multiple nodes
  • Enable BufferedDisplay for smoother rendering
  • Use double-buffering for complex custom drawing
  • Call Invalidate only when necessary
  • Use partial invalidation with InvalidateRect when possible

Common Patterns

Conditional Formatting Based on Level

Custom Backgrounds

Highlighting Effects