TX Text Control .NET Server

GetItem Method

Method|Introduced in 10.1
Namespace
TXTextControl
Package
TXTextControl.TextControl.Core.SDK as TXTextControl.Core.dll from the private NuGet feed or Text Control Offline Packages
Also in
TXTextControl.TextControl.ASP.SDK as TXTextControl.dll

Description

Gets a particular line from the collection.

Syntax

GetItem(Point)

Gets the line at a certain geometrical position.

public Line GetItem(Point location);
ParameterDescription
location

Specifies the line's location. The point must be specified in pixels with an origin at the top left corner of the control.

GetItem(int)

Gets the line at a certain text position.

public Line GetItem(int textPosition);
ParameterDescription
textPosition

Specifies a zero-based text position.

Return Value

The return value is null, if a line could not be found. Otherwise, it is an object of the type Line.

Examples

The following example works with lines in the current document by using LineCollection.get_Item.

LineCollection lineCollection = textControl.Lines;
textControl.Text = "Quarterly results\nRevenue increased by 12%.";

var result = lineCollection.GetItem(new System.Drawing.Point(20, 20));
Console.WriteLine($"Get Item result: {result}");