Declaration procedure Polyline(Points: array of TPoint); overload; procedure Polyline(Points: array of TPoint; PointCount: Integer); overload; Description
Draw a series of joined lines specified by multiple points.
Note:
◼ For a double version use,
PolylineD
◼ For a polygon (closed polyline), use
Polygon
◼ For advanced polygon drawing, use
AdvancedDrawPolyline
GDI+ Method:
GdipDrawLinesI
// Draw a 5-pointed star var pp: array[0..10] of TPoint; begin ImageEnView1.IEBitmap.IECanvas.Pen.Color := clOrangeRed; ImageEnView1.IEBitmap.IECanvas.Pen.Width := 3; pp[0] := Point(175, 50); pp[1] := Point(205, 145); pp[2] := Point(300, 145); pp[3] := Point(225, 205); pp[4] := Point(253, 300); pp[5] := Point(175, 243); pp[6] := Point(98 , 300); pp[7] := Point(128, 205); pp[8] := Point(50 , 145); pp[9] := Point(148, 145); pp[10] := Point(175, 50); ImageEnView1.IEBitmap.IECanvas.Polyline(pp); ImageEnView1.Update(); end; // Method to draw a pointer arrow from LineX1,LineY1 to LineX2, LineY2 // IEDrawLineArrow( ImageEnView1.IEBitmap.IECanvas, 650, 680, 850, 780, 30, 30, clBlack, 2, clYellow ); // ImageEnView1.Update(); procedure IEDrawLineArrow(Canvas: TIECanvas; LineX1, LineY1, LineX2, LineY2: integer; ArrowW, ArrowH: integer; BorderColor: TColor; BorderWidth: Integer; FillColor: TColor); const A90 = PI / 2; var aa, bb, hw: double; pp: array[0..2] of TPoint; p1x, p1y: integer; begin // Border if ( BorderColor = clNone ) or ( BorderWidth < 1 ) then Canvas.Pen.Style := psClear else Canvas.Pen.Style := psSolid; Canvas.Pen.Color := BorderColor; Canvas.Pen.Width := BorderWidth; // Fill if ( FillColor = clNone ) then Canvas.Brush.Style := bsClear else Canvas.Brush.Style := bsSolid; Canvas.Brush.Color := FillColor; Canvas.DrawLine( LineX1, LineY1, LineX2, LineY2 ); hw := ArrowW / 2; aa := IEAngle( LineX1, LineY1, LineX2, LineY2, LineX1, LineY2 ); if LineX1 = LineX2 then if LineY1 < LineY2 then aa := -A90 else aa := A90; if ((LineX1 > LineX2) and (LineY2 < LineY1)) or ((LineX1 < LineX2) and (LineY1 < LineY2)) then bb := 2 * pi - aa + A90 else bb := aa + A90; if ((LineX2 < LineX1) and (LineY2 > LineY1)) or ((LineX2 < LineX1) and (LineY2 < LineY1)) or ((LineX1 < LineX2) and (LineY1 = LineY2)) then begin p1x := LineX1 + trunc(cos(bb - A90) * ArrowH); p1y := LineY1 + trunc(sin(bb - A90) * ArrowH); end else begin p1x := LineX1 + trunc(cos(bb + A90) * ArrowH); p1y := LineY1 + trunc(sin(bb + A90) * ArrowH); end; pp[0].x := p1x + trunc(cos(bb) * hw); pp[0].y := p1y + trunc(sin(bb) * hw); pp[1].x := p1x + trunc(cos(bb + pi) * hw); pp[1].y := p1y + trunc(sin(bb + pi) * hw); pp[2].x := LineX1; pp[2].y := LineY1; Canvas.Polygon(pp); end;
Loading contents...