The DocumentTarget class represents a text position in a Text Control document that can be a target of a document link or a bookmark. For more information see the technical article Text Fields and Hypertext Links.

Syntax

public class DocumentTarget
Public Class DocumentTarget

Examples

The following example shows how to create a DocumentTarget and show its properties in a text box.

//Create DocumentTarget
TXTextControl.DocumentTarget newTarget = new TXTextControl.DocumentTarget("Page1");
//Add newTarget to textControl1 DocumentTarget Collection
textControl1.DocumentTargets.Add(newTarget);

// Dsplay DocumentTarget properties in a textbox
textBox1.Text = "*** Begin Test " + System.DateTime.Now + " ***" + Environment.NewLine + Environment.NewLine +
                "<<< Bounds property >>>" + Environment.NewLine +
                "The X Coordinate is: " + newTarget.Bounds.X + Environment.NewLine +
                "The Y Coordinate is: " + newTarget.Bounds.Y + Environment.NewLine +
                "The Width is: " + newTarget.Bounds.Width + Environment.NewLine +
                "The Height is: " + newTarget.Bounds.Height + Environment.NewLine +
                "The Left value is: " + newTarget.Bounds.Left + Environment.NewLine +
                "The Right value is: " + newTarget.Bounds.Right + Environment.NewLine +
                "The Bottom value is: " + newTarget.Bounds.Bottom + Environment.NewLine +
                "The Top value is: " + newTarget.Bounds.Top + Environment.NewLine +
                "The Is Empty value is: " + newTarget.Bounds.IsEmpty + Environment.NewLine +
                "The Size is: " + newTarget.Bounds.Size + Environment.NewLine +
                "The Location value is: " + newTarget.Bounds.Location";
Dim newTarget As TXTextControl.DocumentTarget = New TXTextControl.DocumentTarget("Page1")
textControl1.DocumentTargets.Add(newTarget)
textBox1.Text = "*** Begin Test " & System.DateTime.Now & " ***" & Environment.NewLine + Environment.NewLine & "<<< Bounds property >>>" + Environment.NewLine & "The X Coordinate is: " + newTarget.Bounds.X + Environment.NewLine & "The Y Coordinate is: " + newTarget.Bounds.Y + Environment.NewLine & "The Width is: " + newTarget.Bounds.Width + Environment.NewLine & "The Height is: " + newTarget.Bounds.Height + Environment.NewLine & "The Left value is: " + newTarget.Bounds.Left + Environment.NewLine & "The Right value is: " + newTarget.Bounds.Right + Environment.NewLine & "The Bottom value is: " + newTarget.Bounds.Bottom + Environment.NewLine & "The Top value is: " + newTarget.Bounds.Top + Environment.NewLine & "The Is Empty value is: " + newTarget.Bounds.IsEmpty + Environment.NewLine & "The Size is: " + newTarget.Bounds.Size + Environment.NewLine & "The Location value is: " + newTarget.Bounds.Location
";"

Constructors

Constructor Description
DocumentTarget Creates a new instance of the DocumentTarget class.

Methods

Method Description
ScrollTo Sets the current text input position to the target's position and scrolls it into the visible part of the document.

Properties

Property Description
Bounds Gets the bounding rectangle of a target.
ContainsInputPosition Returns true, if the target's position is the same as the current text input position.
Deleteable Specifies whether the target can be deleted by the end-user while the document is being edited.
ID Gets or sets an identifier for the document target.
Name Relates a user-defined name to a target, that can be any kind of text in addition to the target's TargetName.
Start Gets the character position (one-based) of the target.
TargetName Gets or sets the target name.