While some posts in this topic are more current, this topic was posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Wednesday, September 16, 2009 7:36:12 PM(UTC)
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
#2
Posted
:
Thursday, September 17, 2009 3:08:56 AM(UTC)
Groups: Guests
Posts: 3,022
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)
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"> <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)
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)
Groups: Registered, Tech Support, Administrators
Posts: 764
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)
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.