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
 Length of an object
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

pierrotsc

USA
497 Posts

Posted - Mar 05 2012 :  08:40:52  Show Profile  Reply
I am trying to find out the length of a text object to be able to center the string in my imageenview.
I use ObjWidth[-1] := length(ObjText[-1]);

my objtext can be different strings.
I used showmessage(inttostr(ObjWidth[-1])); to see the length of my string and i get a value of 49 when it should be more like 700.

What am i doing wrong?
Thanks.
P

fab

1310 Posts

Posted - Mar 05 2012 :  11:31:29  Show Profile  Reply
ObjWidth specifies the width of the object bounding box, that has nothing to do with the length of text.
You could use the method TImageEnVect.StretchTextRect to stretch the bounding box rectangle to the size (width and height) required to fit the text.
Go to Top of Page

pierrotsc

USA
497 Posts

Posted - Mar 05 2012 :  14:40:28  Show Profile  Reply
do not see it in 3.1.2. Is that a new command?
could i use ObjectsExtents instead?
Thanks.
P
Go to Top of Page

fab

1310 Posts

Posted - Mar 06 2012 :  00:17:40  Show Profile  Reply
StretchTextRect is available from 4.1.0.

ObjectsExtents specifies the overall (for all objects) space needed to contains all objects (their bounding boxes).
You could estimate the text width using TCanvas methods (setting the same font and using TextWidth method).
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: