TextField 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
Description
An instance of the TextField class represents a text field in a Text Control document. A text field is a marked piece of text that has properties like text or a name. The TextControl class has several events that inform about different occurrences. For more information see the technical article Text Fields and Hypertext Links.
Syntax
public class TextFieldPublic Class TextFieldExamples
The following example shows how to insert and populate a text field.
TXTextControl.TextField field = new TXTextControl.TextField("Product");
field.Name = "product";
textControl1.TextFields.Add(field);
foreach (TXTextControl.TextField curfield in textControl1.TextFields)
{
if (curfield.Name == "product")
curfield.Text = "TX Text Control";
}Dim field As TXTextControl.TextField = New TXTextControl.TextField("Product")
field.Name = "product"
TextControl1.TextFields.Add(field)
For Each curField As TXTextControl.TextField In TextControl1.TextFields
If curField.Name = "product" Then
curField.Text = "TX Text Control"
End If
NextThe following example inserts a Word-compatible text field into a template.
TextField textField = new ApplicationField(ApplicationFieldFormat.MSWord, "MERGEFIELD", "Customer name", new[] { "CustomerName" });
textControl.TextFields.Add(textField);Dim textField As TextField = New ApplicationField(ApplicationFieldFormat.MSWord, "MERGEFIELD", "Customer name", New String() { "CustomerName" })
textControl.TextFields.Add(textField)Members
Constructors
| Constructor | Description |
|---|---|
| TextField | Creates a new instance of the TextField class. |
Properties
| Property | Description |
|---|---|
| Bounds | Gets the bounding rectangle of a text field. The bounding rectangle is the smallest rectangle which contains all characters of the field's text. The rectangle is given in twips with an origin at the upper left corner of the document. |
| ContainsInputPosition | Returns true, if the Textfield contains the current text input position. |
| Deleteable | Specifies whether a text field can be deleted by the end-user while a TX Text Control document is being edited. The default setting of this property is true. |
| DoubleClickEvent | Specifies whether a TextControl.TextFieldDoubleClicked event is raised, if the end-user doubleclicks the text field. If an event is raised, the normal double-click processing, which selects a single word in the text is suppressed. The default setting of this property is true. |
| DoubledInputPosition | Specifies whether a text field has a doubled input position in front of its first character and behind its last character. This enables an end-user to decide whether inserted text at these positions will belong to the text field or not. The default setting of this property is false. For all form fields to work properly this property is set to true and cannot be changed to false. |
| Editable | Specifies whether the text of a text field can be changed by the end-user while a TX Text Control document is being edited. The default setting of this property is true. |
| FormattingBounds | Gets the formatting rectangle of a text field. The formatting rectangle is the largest rectangle to which the area covered by the field can grow. The rectangle is given in twips with an origin at the upper left corner of the document. |
| HighlightColor | Gets or sets the highlight color for the text field. The color's alpha value must be less than 255 (opaque) so that the text field's text remains visible. The default value is black with an alpha value of 60 (light gray). |
| HighlightMode | Gets or sets a value indicating when the text field is highlighted. |
| ID | Gets or sets an identifier for a text field. This identifier can be used to uniquely identify a text field. |
| IsSpellCheckingEnabled | Specifies whether a text field's text is checked on misspelled words. The default setting of this property is true. |
| Length | Gets the number of characters in a text field. |
| Name | Relates a user-defined name to a text field. This can be any kind of text. This name can be used to uniquely identify a text field. |
| ShowActivated | Obsolete. Specifies whether a text field toggles its background to gray, if the current input position is in the field. The default setting of this property is false. This property is obsolete and has been superseded by the HighlightColor and HighlightMode properties. |
| Start | Gets the first character position (one-based) of a text field. |
| Text | Returns or sets the text which is contained within a text field. This property is not supported for the DocumentTarget class. |
Methods
| Method | Description |
|---|---|
| ScrollTo | Sets the current input position to the beginning of a text field and scrolls it into the visible part of the document. |