Text Navigation in Windows Forms Syntax Editor
18 Nov 20186 minutes to read
The Syntax Editor offers extensive support for text navigation. You can perform navigation at the character, word, line, page, or entire document levels. This section briefly explains navigation of text in the Syntax Editor.

Character based navigation
The following functions enables text navigation in the Syntax Editor in terms of characters or columns.
| Functions | Description |
|---|---|
| Moves cursor up, if possible. | |
| Moves cursor down, if possible. | |
| Moves cursor left, if possible. | |
| Moves cursor right, if possible. |
this.editControl1.MoveUp();
this.editControl1.MoveDown();
this.editControl1.MoveLeft();
this.editControl1.MoveRight();Word based navigation
The following functions enables text navigation in the Syntax Editor in terms of words.
| Functions | Description |
|---|---|
| Moves caret to the left by one word. | |
| Moves caret to the right by one word. |
this.editControl1.MoveLeftWord();
this.editControl1.MoveRightWord();Me.editControl1.MoveLeftWord()
Me.editControl1.MoveRightWord()Line based navigation
The following functions enables text navigation in the Syntax Editor in terms of lines.
| Functions | Description |
|---|---|
| Moves caret to the beginning of the line. First whitespace will be skipped. | |
| Moves caret to the end of the line. |
this.editControl1.MoveToLineStart();
this.editControl1.MoveToLineEnd();Me.editControl1.MoveToLineStart()
Me.editControl1.MoveToLineEnd()Page based navigation
The following functions enables text navigation in the Syntax Editor in terms of pages.
| Functions | Description |
|---|---|
| Moves caret one page up. | |
| Moves caret one page down. |
this.editControl1.MovePageUp();
this.editControl1.MovePageDown();Me.editControl1.MovePageUp()
Me.editControl1.MovePageDown()Block based navigation
Position the keyboard cursor at the beginning and end of the indentation block by using the JumpToIndentBlockStart and JumpToIndentBlockEnd functions respectively.
this.editControl1.JumpToIndentBlockStart();
this.editControl1.JumpToIndentBlockEnd();Me.editControl1.JumpToIndentBlockStart()
Me.editControl1.JumpToIndentBlockEnd()Document based navigation
The following functions enables text navigation in the Syntax Editor in terms of documents.
| Functions | Description |
|---|---|
| Moves caret to the beginning of the file. | |
| Moves caret to the end of the file. |
this.editControl1.MoveToBeginning();
this.editControl1.MoveToEnd();Me.editControl1.MoveToBeginning()
Me.editControl1.MoveToEnd()Retrieve current word
Retrieves the current word in the Syntax Editor by using the GetCurrentWord function.
Console.WriteLine(this.editControl1.GetCurrentWord().ToString());Me.WriteLine(this.editControl1.GetCurrentWord().ToString())Retrieve current column index in line
Retrieves the current word column index in the Syntax Editor by using the GetCurrentWordColumn function and CurrentColumn property.
Console.WriteLine(this.editControl1.GetCurrentWordColumn().ToString());
Console.WriteLine(this.editControl1.CurrentColumn);Me.WriteLine(this.editControl1.GetCurrentWordColumn().ToString())
Me.WriteLine(this.editControl1.CurrentColumn)Retrieve current line index
Retrieves the current word column index in the Syntax Editor by using the CurrentLine property.
Console.WriteLine(this.editControl1.CurrentLine);Me.WriteLine(this.editControl1.CurrentLine)NOTE
Refer to the following sample link that demonstrates the text navigation functionalities in the Syntax Editor:
C:\Users\<User>\AppData\Syncfusion\EssentialStudio\Version Number\Windows\Edit.Windows\Samples\Text Navigation\Text Navigation
Scrolling
The Syntax Editor offers extremely smooth scrolling behavior by using the idle-time processing and dynamic scroll area expansion techniques. The scrolling behavior is smooth even when loading large files though the Syntax Editor scrolls by several hundred lines for a small movement of the scroller.
The scrollers in the Syntax Editor can be optionally shown or hidden by using the following properties.
| Properties | Description |
|---|---|
| Specifies a value indicating whether the vertical scroller can be shown or not. | |
| Specifies a value indicating whether the horizontal scroller can be shown or not. | |
| Specifies a value indicating whether scrollers should always be visible or not. |
// Display the Horizontal Scroller.
this.editControl1.ShowHorizontalScroller = true;
// Display the Vertical Scroller.
this.editControl1.ShowVerticalScroller = true;
this.editControl1.AlwaysShowScrollers = true;// Display the Horizontal Scroller.
Me.editControl1.ShowHorizontalScroller = True
// Display the Vertical Scroller.
Me.editControl1.ShowVerticalScroller = True
Me.editControl1.AlwaysShowScrollers = TrueSupports scroller events that are raised when the scroll arrows are clicked. The scroller events are used to synchronize the scrolling of multiple Syntax Editors.

Scroll position and offsets
The scroll position and offsets of the Syntax Editor are set by using the following properties.
| Properties | Description |
|---|---|
| Specifies scroll position of the Syntax Editor. | |
| Specifies the bottom scroll offset. | |
| Specifies the left scroll offset. | |
| Specifies the right scroll offset. | |
| Specifies the top scroll offset. |
this.editControl1.ScrollPosition = new Point(1, 5);
this.editControl1.ScrollOffsetBottom = 5;
this.editControl1.ScrollOffsetLeft = 10;
this.editControl1.ScrollOffsetTop = 5;
this.editControl1.ScrollOffsetTop = 10;Me.editControl1.ScrollPosition = New Point(1, 5)
Me.editControl1.ScrollOffsetBottom = 5
Me.editControl1.ScrollOffsetLeft = 10
Me.editControl1.ScrollOffsetTop = 5
Me.editControl1.ScrollOffsetTop = 10