AnnTextObject Class (original) (raw)
Summary
Provides support for creating and managing text annotation objects.
Syntax
C#
Objective-C
C++/CLI
Java
Python
@interface LTAnnTextObject : LTAnnRectangleObject<NSCoding, NSCopying>
public class AnnTextObject extends AnnRectangleObject
class AnnTextObject(AnnRectangleObject):
Example
This example creates a text object and adds it to the automation container.
using Leadtools.Annotations.Automation;
using Leadtools.Annotations.Engine;
using Leadtools.Codecs;
using Leadtools.Annotations;
using Leadtools.Annotations.WinForms;
public void AnnCore_AnnTextObject()
{
// assumes _automation is valid
double inch = 720.0;
// Add a text object
AnnTextObject textObj = new AnnTextObject();
// Set the points for the hotspot
textObj.Points.Add(LeadPointD.Create(1 * inch, 1 * inch));
textObj.Points.Add(LeadPointD.Create(2 * inch, 1 * inch));
textObj.Points.Add(LeadPointD.Create(2 * inch, 2 * inch));
textObj.Points.Add(LeadPointD.Create(1 * inch, 2 * inch));
// Set the text
textObj.Text = "sample text for object\nsecond line of text\nlast line";
// Add the object to the automation container
// Set the font size
textObj.Font.FontSize = 16;
_automation.Container.Children.Add(textObj);
}