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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 TIELineLayer Position problem

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
supersk Posted - Oct 14 2019 : 22:29:35
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));


3   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Oct 16 2019 : 18:35:49
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
supersk Posted - Oct 16 2019 : 03:34:13
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
xequte Posted - Oct 15 2019 : 21:55:34
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