GetItem Method
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. Core. SDK TXTextControl.from the private NuGet feed or Text Control Offline PackagesCore. dll
- Also in
TXTextControl.asTextControl. ASP. SDK TXTextControl.dll
Description
Gets a particular character from the collection specified through a certain geometrical position.
Syntax
public TextChar GetItem(Point location, bool getNearest);Public Function GetItem(location As Point, getNearest As Boolean) As TextCharParameters
| Parameter | Description |
|---|---|
| location | Specifies the character's location. The point must be specified in pixels with an origin at the top left corner of the control. |
| getNearest | Specifies whether the nearest character is returned. If this parameter is set to true, the nearest character is returned. Otherwise, if set to false, a character is only returned, if the specified location is inside the bounding rectangle of an existing character. |
Return Value
The return value is null, if a character could not be found. Otherwise, it is an object of the type TextChar.
Examples
The following example works with text chars in the current document by using TextCharCollection.get_Item.
TextCharCollection textCharCollection = textControl.TextChars;
textControl.Text = "Quarterly results\nRevenue increased by 12%.";
var result = textCharCollection.GetItem(new System.Drawing.Point(20, 20), true);
Console.WriteLine($"Get Item result: {result}");Dim textCharCollection As TextCharCollection = textControl.TextChars
textControl.Text = "Quarterly results" & vbCrLf & "Revenue increased by 12%."
Dim result = textCharCollection.GetItem(New System.Drawing.Point(20, 20), True)
Console.WriteLine($"Get Item result: {result}")