SubTextPart Constructor
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. WPF. SDK TXTextControl.from the private NuGet feed or Text Control Offline Packagesdll
Description
Initializes a new instance of the SubTextPart class.
Syntax
SubTextPart(string, int)
Creates a subtextpart with the specified name and/or id. The start and length of the subtextpart are initialized to zero. When a zero-length subtextpart is inserted, the current text selection defines it position and length.
public SubTextPart(string name, int id);Public Sub New(name As String, id As Integer)| Parameter | Description |
|---|---|
| name | Specifies the name of the subtextpart. This parameter can be null or an empty string to indicate, that the subtextpart has no name. |
| id | Specifies an identifier for the subtextpart. This parameter can be 0 to indicate, that the subtextpart has no identifier. |
SubTextPart(string, int, int, int)
Creates a subtextpart with the specified name, id, start position and length.
public SubTextPart(string name, int id, int start, int length);Public Sub New(name As String, id As Integer, start As Integer, length As Integer)| Parameter | Description |
|---|---|
| name | Specifies the name of the subtextpart. This parameter can be null or an empty string to indicate, that the subtextpart has no name. |
| id | Specifies an identifier for the subtextpart. This parameter can be 0 to indicate, that the subtextpart has no identifier. |
| start | Specifies the index (one-based) of the first character which belongs to the subtextpart. |
| length | Specifies the number of characters which belong to the subtextpart. |
Examples
The following example marks the selected customer name as a named document region.
textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
SubTextPart subTextPart = new("CustomerName", 10);
textControl.SubTextParts.Add(subTextPart);textControl.Text = "Customer: Contoso Ltd."
textControl.Select(10, 12)
Dim subTextPart As New SubTextPart("CustomerName", 10)
textControl.SubTextParts.Add(subTextPart)