procedure TForm1.Button1Click(Sender: TObject);
{ This example paints a black line from the center of the bitmap to various
specified points in 360 degree circle around the center point. }
var
i: Integer;
ihobj: Integer;
begin
{ Add 10 lines }
for i := 0 to 9 do
with ImageEnVect1 do
begin
ihobj := AddNewObject;
{ Create a line label so we can add text describing the line }
ObjKind[ihobj] := iekLINELABEL;
{ Make the line black }
ObjPenColor[ihobj] := clBlack;
{ Set the line height }
ObjPenWidth[ihobj] := 2;
ObjPenStyle[ihobj] := psSolid;
{ Set the center point }
ObjLeft[ihobj] := IEBitmap.Width div 2;
ObjTop[ihobj] := IEBitmap.Height div 2;
{ Remove the labels border }
ObjLabelBorder[ihobj] := ielNone;
{ Set the ObjWidth and ObjHeight to position the ending point of the line
and to set the objects text. Think of a line being drawn in a TRect,
where the Rect is TRect(IEBitmap.Width div 2, IEBitmap.Height div 2,
ObjWidth[ihobj], ObjHeight[ihobj]). To position the end of a line one
to the left of the center point negative values and to position the
end of the line to the right of the center point use positive values. }
if i = 0 then begin
ObjWidth[ihobj] := 50;
ObjHeight[ihobj] := -85;
ObjText[0] := 'Line 1 (50,-85)';
end
else if i = 1 then begin
ObjWidth[ihobj] := -157;
ObjHeight[ihobj] := 90;
ObjText[1] := 'Line 2 (-157,90}';
end
else if i = 2 then begin
ObjWidth[ihobj] := -175;
ObjHeight[ihobj] := -50;
ObjText[2] := 'Line 3 (-175,-50)';
end
else if i = 3 then begin
ObjWidth[ihobj] := 100;
ObjHeight[ihobj] := 200;
ObjText[3] := 'Line 4 (100,200)';
end
else if i = 4 then begin
ObjWidth[ihobj] := -100;
ObjHeight[ihobj] := -200;
ObjText[4] := 'Line 5 (-100, -200)';
end
else if i = 5 then begin
ObjWidth[ihobj] := -100;
ObjHeight[ihobj] := -125;
ObjText[5] := 'Line 6 (-100,125)';
end
else if i = 6 then begin
ObjWidth[ihobj] := 300;
ObjHeight[ihobj] := 0;
ObjText[6] := 'Line 7 (300,0)';
ObjPenStyle[ihobj] := psDot;
ObjPenWidth[ihobj] := 3;
end
else if i = 7 then begin
ObjWidth[ihobj] := -300;
ObjHeight[ihobj] := 0;
ObjText[7] := 'Line 8 (-300,0)';
ObjPenStyle[ihobj] := psDot;
ObjPenWidth[ihobj] := 3;
end
else if i = 8 then begin
ObjWidth[ihobj] := 0;
ObjHeight[ihobj] := 300;
ObjText := 'Line 9 (0,300)';
ObjPenStyle[ihobj] := psDot;
ObjPenWidth[ihobj] := 3;
end
else if i = 9 then begin
ObjWidth[ihobj] := 0;
ObjHeight[ihobj] := -300;
ObjText[9] := 'Line 10 (0, -300)';
ObjPenStyle[ihobj] := psDot;
ObjPenWidth[ihobj] := 3;
end;
end;
To precisely position the line, change the ObjWidth and ObjHeight values accordingly.
William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Custom ImageEn Development