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
 Length of an object

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
pierrotsc Posted - Mar 05 2012 : 08:40:52
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
3   L A T E S T    R E P L I E S    (Newest First)
fab Posted - Mar 06 2012 : 00:17:40
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).
pierrotsc Posted - Mar 05 2012 : 14:40:28
do not see it in 3.1.2. Is that a new command?
could i use ObjectsExtents instead?
Thanks.
P
fab Posted - Mar 05 2012 : 11:31:29
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.