Making the RichTextBox scroll back..

Tyger
01-25-2001, 01:58 PM
When you change the TextRTF property of the Rich TextBox Control, it moves the cursor to the beginning and scrolls to there. I know I can set SelStart and SelLength to move it back, but I also want it to be scrolled to the same position as it was. I tried sending the EM_LINESCROLL message to the Rich TextBox, but it keeps scrolling all the way to the bottom, so that the last line is the only visible line at the top. (By the way, I'm using the EM_GETFIRSTVISIBLELINE message to get the position I'm at in the beginning..) For example, If I want it to scroll down 40 lines and it's currently at line 0, it still goes all the way down to line 141.

Here's the line of code I'm trying to use to send the message:
SendMessage(RText.hWnd, EM_LINESCROLL, 0, TopLine)

At this point, it's scrolled all the way up. I set TopLine to 40 just to test it out. There are 141 lines, and that's how far down it ends up going.. By the way, TopLine is a Long.

Why does EM_LINESCROLL keep moving it to the bottom like that? Also, is there a better way of doing this?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum