TX Text Control .NET for Windows Forms

HypertextLinkCollection Class

Class
Namespace
TXTextControl
Package
TXTextControl.TextControl.WinForms.SDK from the private NuGet feed or Text Control Offline Packages
Assembly
TXTextControl.dll
Install
dotnet add package TXTextControl.TextControl.WinForms.SDK .NET 8 and later. For .NET Framework, reference TXTextControl.dll from the setup.
Inherits
  1. TextFieldCollectionBase
  2. HypertextLinkCollection
Implements
ICollection, IEnumerable

Description

An instance of the HypertextLinkCollection class contains all hypertext links in a Text Control document represented through objects of the type HypertextLink. An instance of this class can be obtained with the TextControl.HypertextLinks property. The HypertextLinkCollection class implements the IEnumerable and the ICollection interfaces. For more information see the technical article Text Fields and Hypertext Links.

Syntax

public sealed class HypertextLinkCollection : TextFieldCollectionBase

Examples

The following example works with hypertext links in the current document.

textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
HypertextLinkCollection hypertextLinkCollection = textControl.HypertextLinks;
hypertextLinkCollection.Add(new HypertextLink("Documentation", "https://docs.textcontrol.com/") { ID = 100 });

Members

Properties

PropertyDescription
CanAddGets a value indicating whether a new text field can be inserted at the current input position. It is true if a text field can be inserted, otherwise it is false. Text Control cannot insert a text field inside of another text field. (Inherited from TextFieldCollectionBase.)
CountGets the number of elements contained in the collection. (Inherited from TextFieldCollectionBase.)
IsSynchronizedReturns true if the collection is designed to be thread safe, otherwise, it returns false. (Inherited from TextFieldCollectionBase.)
ItemGets the field with the specified number from the collection. The number must be between 1 and Count. In C# this property is the indexer for the HypertextLinkCollection class.
SyncRootGets an object that can be used to synchronize access to the collection. (Inherited from TextFieldCollectionBase.)

Methods

MethodDescription
AddInserts a new hypertext link at the current input position.
ClearRemoves all hypertext links from a Text Control document.
CopyToCopies the elements of the collection to an array, starting at a particular index.
GetEnumeratorReturns an enumerator that can be used to iterate through the collection. (Inherited from TextFieldCollectionBase.)
GetItemGets a particular hypertext link from the collection.
RemoveRemoves a hypertext link from a Text Control document.