Current View Display Lines

SyntaxEditor for Windows Forms Forum

Posted 14 years ago by Hassan
Version: 3.1.0225
Hi !

I am trying to retrieve the text of the lines that are displayed in the selected view. For example, if the currently selected view is displaying the lines 3 To 41, then I want to retrieve the text of these lines. I tried a few methods in SyntaxEditor.SelectedView, but I can't find the function that can do it.

Kindly show me the way to do it.


Comments (2)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Hassan,

Something like this is probably what you want:
TextRange range = new TextRange(
    editor.SelectedView.DisplayLines[editor.SelectedView.FirstVisibleDisplayLineIndex + Math.Max(0, editor.SelectedView.VisibleDisplayLineCount - 1)].EndOffset
string text = editor.Document.GetSubstring(range);

Actipro Software Support

Posted 14 years ago by Hassan
Thanks a lot Sir. Worked great (:
The latest build of this product (v24.1.0) was released 4 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.