TextFrameCollection Class
- Namespace
TXTextControl
- Package
TXTextControl.from the private NuGet feed or Text Control Offline PackagesTextControl. WinForms. SDK
- Assembly
TXTextControl.dll
- Install
dotnet add package TXTextControl..NET 8 and later. For .NET Framework, referenceTextControl. WinForms. SDK TXTextControl.from the setup.dll
- Inherits
- Frame
Base Collection - Text
Frame Collection
- Frame
- Implements
- ICollection, IEnumerable
Description
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.
Syntax
public sealed class TextFrameCollection : FrameBaseCollectionPublic NotInheritable Class TextFrameCollection
Inherits FrameBaseCollectionExamples
The following example checks all text frames in the collection and adds text field if the back color is blue:
foreach (TXTextControl.TextFrame myFrame in textControl1.TextFrames)
{
if (myFrame.BackColor == Color.Blue)
{
myFrame.TextFields.Add(new TXTextControl.TextField("Text field"));
}
}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
NextThe following example works with text frames in the current document.
TextFrameCollection textFrameCollection = textControl.TextFrames;
textFrameCollection.Add(new TextFrame(new System.Drawing.Size(3000, 1200)) { Name = "Callout", ID = 100 }, TextFrameInsertionMode.DisplaceText);Dim textFrameCollection As TextFrameCollection = textControl.TextFrames
textFrameCollection.Add(New TextFrame(New System.Drawing.Size(3000, 1200)) With { .Name = "Callout", .ID = 100 }, TextFrameInsertionMode.DisplaceText)Members
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 | 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. An activated text frame has the input focus and can be edited. The method returns null, if no text frame is activated. |
| GetEnumerator | Returns an enumerator that can be used to iterate through the collection. (Inherited from FrameBaseCollection.) |
| GetItem | Gets a particular text frame from the collection. |
| Remove | Removes a text frame from a Text Control document. |