| Code: |
| TTriangularNode = class(TPolygonalNode)
protected function GetMaxTextRect: TRect; override; class procedure DefineVertices(const ARect: TRect; var Points: TPointArray); override; end; class procedure TTriangularNode.DefineVertices(const ARect: TRect; var Points: TPointArray); begin SetLength(Points, 3); with ARect do begin with Points[0] do begin X := (Left + Right) div 2; Y := Top; end; with Points[1] do begin X := Right; Y := Bottom; end; with Points[2] do begin X := Left; Y := Bottom; end; end; end; function TTriangularNode.GetMaxTextRect: TRect; begin with Result do begin Left := (Vertices[0].X + Vertices[2].X) div 2; Top := (Vertices[0].Y + Vertices[2].Y) div 2; Right := (Vertices[0].X + Vertices[1].X) div 2; Bottom := Vertices[1].Y; end; OffsetRect(Result, -Left, -Top); IntersectRect(Result, Result, inherited GetMaxTextRect); end; |
| Code: |
| TSimpleGraph.Register(TTriangularNode); |
output generated using printer-friendly topic mod. All times are GMT