ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 TIELineLayer Position problem
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

supersk

95 Posts

Posted - Oct 14 2019 :  22:29:35  Show Profile  Reply
I want to add a line using the LinePoint1 and LinePoint2, but the line position is different from the drawing line.How to set linelayer to correct position?
Thanks.
The code as following:
ImgEnMain->LayersAdd(ielkLine);
TIELineLayer* CTlyr;
CTlyr = ((TIELineLayer*)ImgEnMain->CurrentLayer);
CTlyr->LinePoint1 = TPoint(StrToInt(Edit1->Text), StrToInt(Edit2->Text));
CTlyr->LinePoint2 = TPoint(StrToInt(Edit3->Text), StrToInt(Edit4->Text));
CTlyr->BorderColor = clYellow;
CTlyr->IsRuler = false;
CTlyr->LabelPosition = ielpAutoAbove;
CTlyr->LabelFont->Name = "Times New Roman";
CTlyr->LabelFont->Color = clYellow;
CTlyr->LabelFont->Style = TFontStyles() << fsBold;

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));


xequte

38179 Posts

Posted - Oct 15 2019 :  21:55:34  Show Profile  Reply
Hi

It aligns perfectly on my system.

What is the size of ImgEnMain->IEBitmap. How does it align with the coordinates of the TImageEnView?

It looks like you've set IsRuler to false, but the image looks like a ruler. Is that code valid to see the issue?

Please also see:

https://www.imageen.com/help/TImageEnView.XScr2Bmp.html
https://www.imageen.com/help/TImageEnView.YScr2Bmp.html

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

supersk

95 Posts

Posted - Oct 16 2019 :  03:34:13  Show Profile  Reply
I just want to add a line.My code as follow.Meanwhile,I'll email the code to you.

attach/supersk/201910163345_LineErr.zip
9.74 KB
Go to Top of Page

xequte

38179 Posts

Posted - Oct 16 2019 :  18:35:49  Show Profile  Reply
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
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: