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 theGetShapePoints method to define your custom points.
Method 2: Override DrawShapeCanvas
For complete drawing control, override theDrawShapeCanvas 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 fromTTreeCustomPolygonShape:
Registering Custom Shapes
Register your shapes to appear in the component palette:Custom Shape Best Practices
Performance Optimization
Performance Optimization
- Minimize point count in
GetShapePoints - Cache calculated values when possible
- Use
SetIntegerPropertyand similar helpers for property changes - Call
inheritedinDrawShapeCanvasto leverage base functionality
Design Guidelines
Design Guidelines
- Set sensible default colors and sizes in constructor
- Validate property ranges
- Provide clear property names and tooltips
- Test with various sizes and aspect ratios
User Experience
User Experience
- Implement custom handles for shape-specific adjustments
- Provide visual feedback during resize
- Support AutoSize when appropriate
- Handle mouse cursors correctly
Code Organization
Code Organization
- 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
