Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, September 16, 2009 7:36:12 PM(UTC)

prgrmmr  
prgrmmr

Groups: Registered
Posts: 6


Hi,
I am using LEADTOOLS version 16 .NET classes.

What i want to do is to use a AnnTextObject to show some result that i can only get by my programme.
How to determine the Bounds property dynamically when i use AnnTextObject to output the result?

Thanks,

Simon
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Thursday, September 17, 2009 3:08:56 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,034

Was thanked: 2 time(s) in 2 post(s)

Simon,
If you mean that you want to change the AnnTextObject.Bounds property, you can get the current object being edited using the AnnAutomation.CurrentEditObject Property and check if this is an AnnTextObject. If it is an AnnTextObject, you can change the Bounds of the object.
For more information please check the .NET help file.
 
#3 Posted : Thursday, September 17, 2009 8:12:00 AM(UTC)

prgrmmr  
prgrmmr

Groups: Registered
Posts: 6


Hi Adam,
Thank you for reply.
<BLOCKQUOTE><table width="85%"><tr><td class="txt4"><img src="/SupportPortal/CS/Themes/default/images/icon-quote.gif">&nbsp;<strong>Adam Boulad wrote:</strong></td></tr><tr><td class="quoteTable"><table width="100%"><tr><td width="100%" valign="top" class="txt4">Simon,<br>AnnAutomation.CurrentEditObject Property and check if this is an AnnTextObject. If it is an AnnTextObject, you can change the Bounds of the object. <br>For more information please check the .NET help file.</td></tr></table></td></tr></table></BLOCKQUOTE>

Sorry for my inaccurate description.
What i want to do is something like this.
============================================
String sResult = [something i got by a caculation (not a fixed length string, even multi-lines)]
//I want to use a AnnTextObject to show it.
AnnTextObject annText = new AnnTextObject();
annText.text = sResult;
annText.Font = new AnnFont("Arial", new AnnLength(10, AnnUnit.Point), FontStyle.Regular);
annText.TextRotate = AnnTextRotate.Rotate0;
//How could i specifiy an appropriate Bounds(width and height) here.So the bounds could JUST FIT the size of my content.
annText.Bounds = new AnnRectangle(100, 100, 100, 100, AnnUnit.Pixel);
annContainer.Objects.Add(text);
============================================
Thanks,
Simon
 
#4 Posted : Thursday, September 17, 2009 8:27:42 AM(UTC)

prgrmmr  
prgrmmr

Groups: Registered
Posts: 6


Or is there some Inner-Relationship between the
System.Drawing.Graphic.MeasureString
and the Size we shold specify here?
 
#5 Posted : Friday, September 18, 2009 8:53:11 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 766


Yes, you will need to use System.Drawing.Graphics.MeasureString to get the width and height that the string will use based on the font.  As long as you use the same font size and family in both MeasureString and the AnnTextObject, it should be the minimum size for that object. 
 
#6 Posted : Tuesday, February 18, 2020 3:22:18 AM(UTC)

ehk  
ehk

Groups: Registered
Posts: 15


Hello Leadtools,

I have the same problem today as mentioned above by [prgrmmr], my question is: What is the alternative of the following code in Leadtools-version-20, to keep fontsize scale to the size of image?

//old code example :
AnnTextObject annText = new AnnTextObject();
annText.text = "Hello";
annText.Font = new AnnFont("Arial", new AnnLength(10, AnnUnit.Point), FontStyle.Regular);
annText.Bounds = new AnnRectangle(100, 100, 100, 100, AnnUnit.Pixel); //<------alternative in version-20 ?
annContainer.Objects.Add(text);


Thanks in advance.

Edited by user Tuesday, February 18, 2020 9:45:32 AM(UTC)  | Reason: Not specified

 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2020, Yet Another Forum.NET
This page was generated in 0.197 seconds.