Hi
Setting the End Shapes or IsRuler properties will move the line because the text/shapes need to accommodated, so set the style properties first, and then set the line position (e.g. using SetLinePointsEx)
procedure TForm1.Button1Click(Sender: TObject);
var
CTlyr : TIELineLayer;
begin
ImgEnMain.LayersAdd(ielkLine);
ImgEnMain.LayersAlign(ilaAlignToLeft);
CTlyr := TIELineLayer(ImgEnMain.CurrentLayer);
CTlyr.RulerUnits := ieuMillimeters;
CTlyr.IsRuler := true;
CTlyr.TextOverflow := ieoShrink;
CTlyr.LabelFont.Color := clRed;
CTlyr.BorderColor := clRed;
CTlyr.LabelAlignment := iejCenter;
CTlyr.LabelPosition := ielpAutoAbove;
CTlyr.StartShape := ieesBar;
CTlyr.EndShape := ieesBar;
CTlyr.ShapeSize := 20;
CTlyr.LinePoint1 := Point(StrToInt(Edit1.Text), StrToInt(Edit2.Text));
CTlyr.LinePoint2 := Point(StrToInt(Edit3.Text), StrToInt(Edit4.Text));
CTlyr.BorderColor := clBlue;
CTlyr.IsRuler := false;
CTlyr.LabelPosition := ielpAutoAbove;
CTlyr.LabelFont.Color := clYellow;
CTlyr.SetLinePointsEx(StrToInt(Edit1.Text), StrToInt(Edit2.Text),
StrToInt(Edit3.Text), StrToInt(Edit4.Text));
ImgEnMain.Update;
ImgEnMain.layersCurrent := 0;
ImgEnMain.IEBitmap.Canvas.Pen.Mode := pmCopy;
ImgEnMain.IEBitmap.Canvas.Pen.Color := clRed;
ImgEnMain.IEBitmap.Canvas.MoveTo(StrToInt(Edit1.Text), StrToInt(Edit2.Text));
ImgEnMain.IEBitmap.Canvas.LineTo(StrToInt(Edit3.Text), StrToInt(Edit4.Text));
ImgEnMain.Update;
end;
Nigel
Xequte Software
www.imageen.com