TXTextControl.TextFrameCollection Class

An instance of the TextFrameCollection class contains all text frames in a Text Control document or part of the document represented through objects of the type TextFrame. An instance of this class can be obtained with the TextControl.TextFrames or the HeaderFooter.TextFrames property. The TextFrameCollection class implements the IEnumerable and the ICollection interfaces.

Introduced: 12.0.

Syntax

[C#]
public sealed class TextFrameCollection: FrameBaseCollection
[Visual Basic]
Public NotInheritable Class TextFrameCollection
  Inherits FrameBaseCollection

Properties

Property Description
Count Gets the number of elements contained in the collection. (Inherited from FrameBaseCollection.)
IsSynchronized Returns true if the collection is designed to be thread safe, otherwise, it returns false. (Inherited from FrameBaseCollection.)
SyncRoot Gets an object that can be used to synchronize access to the collection. (Inherited from FrameBaseCollection.)

Methods

Method Description
Add Overloaded. Inserts a new text frame in a Text Control document.
Clear Removes all objects from the collection and from the document. (Inherited from FrameBaseCollection.)
CopyTo Copies the elements of the collection to an array, starting at a particular index.
DeactivateItem Deactivates the activated text frame and sets the input focus back to the text part that contains the text frame.
GetActivatedItem Returns the currently activated text frame.
GetEnumerator Returns an enumerator that can be used to iterate through the collection. (Inherited from FrameBaseCollection.)
GetItem Overloaded. Gets a particular text frame from the collection.
Remove Removes a text frame from a Text Control document.

Example

The following example checks all text frames in the collection and adds text field if the back color is blue:

[C#]
foreach (TXTextControl.TextFrame myFrame in textControl1.TextFrames)
{
    if (myFrame.BackColor == Color.Blue)
    {
        myFrame.TextFields.Add(new TXTextControl.TextField("Text field"));
    }
}
[Visual Basic]
For Each MyFrame As TXTextControl.TextFrame In TextControl1.TextFrames
    If MyFrame.BackColor = Color.Blue Then
        MyFrame.TextFields.Add(New TXTextControl.TextField("Text field"))
    End If
Next

See Also