Skip to main content

Overview

TeeTree allows you to create completely custom shapes by inheriting from base shape classes and overriding specific methods. This gives you full control over shape appearance, behavior, and interaction.

Inheritance Hierarchy

Creating Custom Shapes

Method 1: Override GetShapePoints

For polygon-based shapes, override the GetShapePoints method to define your custom points.

Method 2: Override DrawShapeCanvas

For complete drawing control, override the DrawShapeCanvas method.

Complete Custom Shape Examples

Example 1: Custom Pentagon

Example 2: Custom Gear Shape

Example 3: Custom Badge Shape

Advanced Custom Shape Features

Adding Custom Handles

Override handle methods to add custom resize handles:

Custom Properties with Change Notification

Using TTreeCustomPolygonShape

For regular polygons, inherit from TTreeCustomPolygonShape:

Registering Custom Shapes

Register your shapes to appear in the component palette:

Custom Shape Best Practices

  • Minimize point count in GetShapePoints
  • Cache calculated values when possible
  • Use SetIntegerProperty and similar helpers for property changes
  • Call inherited in DrawShapeCanvas to leverage base functionality
  • Set sensible default colors and sizes in constructor
  • Validate property ranges
  • Provide clear property names and tooltips
  • Test with various sizes and aspect ratios
  • Implement custom handles for shape-specific adjustments
  • Provide visual feedback during resize
  • Support AutoSize when appropriate
  • Handle mouse cursors correctly
  • Keep shape logic in separate unit
  • Document special properties and behaviors
  • Register/unregister shapes properly
  • Follow TeeTree naming conventions

Complete Custom Shape Unit Template

Drawing Helper Reference

Canvas3D Drawing Methods

Geometry Helpers

See Also

Basic Shapes

Learn from built-in basic shapes

Flowchart Shapes

Study flowchart shape implementations

UML Shapes

Review UML shape patterns

Electric Shapes

Examine circuit shape techniques