TX Text Control .NET for Windows Forms

ScrollTo Method

Method|Introduced in 23.0
Namespace
TXTextControl
Package
TXTextControl.TextControl.WinForms.SDK as TXTextControl.dll from the private NuGet feed or Text Control Offline Packages

Description

Sets the current input position to the beginning of a subtextpart and scrolls it into the visible part of the document.

Syntax

public bool ScrollTo();

Return Value

The return value is true, if the subtextpart could be scrolled. Otherwise it is false.

Examples

The following example marks the selected customer name as a named document region by using SubTextPart.ScrollTo.

textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
SubTextPart subTextPart = new("CustomerName", 10);
textControl.SubTextParts.Add(subTextPart);

if (subTextPart.ScrollTo())
{
    Console.WriteLine("Scroll To completed successfully.");
}