ImageEn, unit iexLayers

TIELineLayer.LinePoint2

TIELineLayer.LinePoint2


Declaration

property LinePoint2: TPoint;


Description

Provides an alternate method to set the position of a line, by specifying its start and end points. LinePoint1 is the starting point and LinePoint2 is the ending point.
Values are specified in terms of the background bitmap.

Note: When setting LinePoint2, end shapes and label are not taken into account


Comparison

TIELineLayer provides three ways to position the line depending on your requirements. All the following create a 45 deg. line from 100,100 to 300,300

1. Standard TIELayer methods

ImageEnView1.CurrentLayer.PosX   := 100;
ImageEnView1.CurrentLayer.PosY   := 100;
ImageEnView1.CurrentLayer.Width  := 200;
ImageEnView1.CurrentLayer.Height := 200;

2. Setting starting and end points

TIELineLayer( ImageEnView1.CurrentLayer ).LinePoint1 := Point( 100, 100 );
TIELineLayer( ImageEnView1.CurrentLayer ).LinePoint2 := Point( 300, 300 );

2. Setting line length

TIELineLayer( ImageEnView1.CurrentLayer ).AutoSize := False;
ImageEnView1.CurrentLayer.PosX   := 100;
ImageEnView1.CurrentLayer.PosY   := 100;
ImageEnView1.CurrentLayer.Rotate := -45;
TIELineLayer( ImageEnView1.CurrentLayer ).LineLength := 280;



Example

// Create a line from 100,100 to 200,200
ImageEnView1.LayersAdd( ielkLine );
TIELineLayer( ImageEnView1.CurrentLayer ).LinePoints := Rect( 100, 100, 200, 200 );
ImageEnView1.Update();

// Display points of the current line layer
with TIELineLayer( ImageEnView1.CurrentLayer ) do
begin
  lblPoint1.Caption := Format( 'Point 1: %d, %d', [ LinePoints.Left, LinePoints.Top ]);
  lblPoint2.Caption := Format( 'Point 2: %d, %d', [ LinePoints.Right, LinePoints.Bottom ]);
end;


See Also

LinePoint1
LineLength
Points
GetPoints
SetPoints