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
 TImageEnView Wrapping Multiple Lines of Text
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Ken Randall

31 Posts

Posted - Oct 20 2020 :  05:06:49  Show Profile  Reply
Hi,

I have an postal address (strings) that I want to write out to the canvas.

if the length of any line of text is too big I want to word wrap it onto the next line of the canvas and subsequent lines should be beneath this.

How can I achieve this.

Thanks,

Ken

Ken R

Ken Randall

31 Posts

Posted - Oct 20 2020 :  07:25:32  Show Profile  Reply
Ok. I worked this out for myself:

Y:=30;
R:=TRect.Create(10,30,190,180);
for I:=1 to AddCount do
begin
  S:=Uppercase(SL[I]);
  if S<>'' then
  begin
    DrawText(S,R);
    Y:=Y+MeasureText(S,R,0).cy;
    R.Top:=Y;
  end;
end;


Ken R
Go to Top of Page

xequte

38186 Posts

Posted - Oct 20 2020 :  19:51:18  Show Profile  Reply
Hi Ken

Actually you can just use TextOut with a rect parameter. It will automatically handle the wrapping:

// Draw text inside a rectangle of (100,100,200,200) auto-wrapping as necessary
ImageEnView1.Proc.TextOut( Rect(100, 100, 200, 200) , 'TImageEnProc provides image processing and analysis functionality to a TImageEnView, TIEBitmap, TImage or TBitmap component.' );


https://www.imageen.com/help/TImageEnProc.TextOut.html

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: