GetItem Method
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. WPF. SDK TXTextControl.from the private NuGet feed or Text Control Offline Packagesdll
Description
Gets a particular paragraph from the collection.
Syntax
GetItem(Point)
Gets the paragraph at a certain geometrical position.
public Paragraph GetItem(Point location);Public Function GetItem(location As Point) As Paragraph| Parameter | Description |
|---|---|
| location | Specifies the paragraph's location. The point must be specified in pixels with an origin at the top left corner of the control. |
GetItem(int)
Gets the paragraph at a certain text input position.
public Paragraph GetItem(int textPosition);Public Function GetItem(textPosition As Integer) As Paragraph| Parameter | Description |
|---|---|
| textPosition | Specifies a zero-based text position. |
Return Value
The return value is null, if a paragraph could not be found. Otherwise, it is an object of the type Paragraph.
Examples
The following example works with paragraphs in the current document by using ParagraphCollection.get_Item.
ParagraphCollection paragraphCollection = textControl.Paragraphs;
textControl.Text = "Quarterly results\nRevenue increased by 12%.";
Paragraph result = paragraphCollection.GetItem(new System.Drawing.Point(20, 20));
result?.Select();Dim paragraphCollection As ParagraphCollection = textControl.Paragraphs
textControl.Text = "Quarterly results" & vbCrLf & "Revenue increased by 12%."
Dim result As Paragraph = paragraphCollection.GetItem(New System.Drawing.Point(20, 20))
If result IsNot Nothing Then result.Select()