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 : Monday, October 15, 2018 7:26:08 AM(UTC)

SaschaH  
SaschaH

Groups: Registered
Posts: 1


Hello,

we are using annotations and let our users create them in our software written in C#. When working with text annotations such as AnnTextObject we can utilize the AnnTextEditDesigner to allow user input directly on the document.

Is there a way to let the text input (and the underlying AnnTextObject) dynamically resize while the user is typing? There is the property autoSizeAfterEdit, but it only applies after edit as the name suggests, offers little flexibility how to resize and in my test did not resize at all (maybe I'm missing something here as I'm new to LEADTOOLS). Ideally we would like to have the AnnTextObject grow to the right and downwards as needed as the text reaches the borders.

We tried to do the resize ourselves, but it seems neither the keydown event of the AnnTextEditDesigner nor of the RasterImageViewer gets fired when typing text into the annotation and then there could also be changes issued via mouse. Are we missing something, or is this not possible using the AnnTextEditDesigner?
 

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 : Monday, October 15, 2018 8:30:00 AM(UTC)
Anthony Northrup

Groups: Registered, Tech Support, Administrators
Posts: 199

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

Hello,

Unfortunately the text box you actually type into is a native text box, specifically the Leadtools.Annotations.Winforms.AutomationTextBox. In order to resize the text box while you're typing you'd need to hook into the TextChanged event of that text box. Alternatively you can add to the existing OnKeyPress or OnPreviewKeyDown event handlers.

The source for that text box can be found in the following file:
LEADTOOLS 20\Examples\DotNet\CS\Leadtools.Annotations.Winforms\UI\Controls\AutomationTextBox.cs

Note, you'll need to rebuild the Leadtools.Annotations.Winforms assembly, then rebuild your own project before any changes will take effect.

For calculating the size the text box needs to be, you'll want to use the MeasureString method (and possibly inflate by 12x12 like the original AutomationTextBox does in the constructor:
https://www.leadtools.com/help/leadtools/v20/dh/ac/annrenderingengine-measurestring.html

Thanks,
Anthony Northrup
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
 
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-2019, Yet Another Forum.NET
This page was generated in 0.137 seconds.