Declaration
procedure SetPoints(StartX, StartY, EndX, EndY: Double; PointBase: TIEPointBase = iepbBitmap; SnapAngles: Boolean = False; FixToStartPt: Boolean = True);
procedure SetPoints(Points: array of TPoint; PointBase: TIEPointBase = iepbBitmap; SnapAngles: Boolean = False; FixToStartPt: Boolean = True); overload;
procedure SetPoints(Index: Integer; X, Y: Integer; PointBase: TIEPointBase = iepbBitmap; SnapAngles: Boolean = False; FixToStartPt: Boolean = True); overload;
Description
Provides an alternate method to set the position of a line, by specifying its start and end points. The points are expressed by starting ending Points.
It is the same as setting
LinePoint 1 and 2, but provides some extra parameters.
Parameter | Description |
StartX, StartY | The start point of the line |
EndX, EndY | The end point of the line |
SnapAngles | Set to true to adjust the angle to ensure it aligns with LayersRotateStep (e.g. force it to 45 deg. steps) |
FixToStartPt | If we are moving an existing line, which point should not move, the starting or ending point? (Only relevant if SnapAngles = True) |
// Create a line from 100,100 to 200,200
ImageEnView1.LayersAdd( ielkLine );
TIELineLayer( ImageEnView1.CurrentLayer ).SetPoints( 100, 100, 200, 200 );
ImageEnView1.Update();
// Which is the same as...
ImageEnView1.LayersAdd( 100, 100, 200, 200 );
// Which is the same as...
ImageEnView1.LayersAdd( ielkLine );
TIELineLayer( ImageEnView1.CurrentLayer ).LinePoint1 := Point( 100, 100 );
TIELineLayer( ImageEnView1.CurrentLayer ).LinePoint2 := Point( 200, 200 );
ImageEnView1.Update();
// Add a 5-pointed star polyline layer
var
pp: array[0..10] of TPoint;
polyLayer: TIEPolylineLayer;
begin
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.LayersAdd( ielkPolyline );
polyLayer := TIEPolylineLayer( ImageEnView1.CurrentLayer );
polyLayer.LineColor := clOrangeRed;
polyLayer.LineWidth := 3;
polyLayer.FillColor := clYellow;
polyLayer.SetPoints( pp, True, iepbBitmap );
ImageEnView1.Update();
end;
See Also
◼LinePoint1
◼LinePoint2
◼LineLength
◼Points
◼GetPoints