GoToLine displayLinesAbove setting

SyntaxEditor for Windows Forms Forum

Posted 18 years ago by Blair Leggett
Avatar
Hi,

I'm writing an application where I would like to remember where a user last editied a file on shutdown, and then when they relaunch that application their cursor is placed back exactly where they left it.

(Baring any missing lines or other problems which can be ignored for the moment)

I'm able to place the Caret in the exact location using Caret.Offset & GoToLine.
But what I'd really like to do is reposition the editor in the exact way using the displayLinesAbove parameter in the GoToLine method.

But I don't know how to find out how many lines were above the Caret when the user shut the application down. So when I reload their document, it is not in the same vertical position on screen; although, the cursor is in the exact same position.

Does anyone have any ideas on how I would be able to figure out the Screen placement of the Caret, so that I can pass the correct displayLinesAbove into the GoToLine method on reboot?

Thanks,
Blair

Comments (2)

Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Blair,

Actually check out the EditorView.FirstVisibleDisplayLineIndex property. You can get/set that and it returns the index of the first visible line. Setting it will scroll the editor. If you set it then move the caret back to it's previous location you should mimic the previous editor state.


Actipro Software Support

Posted 18 years ago by Blair Leggett
Avatar
Cool thanks!!!!
The latest build of this product (v24.1.0) was released 25 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.