pjv Posted October 2, 2003 Posted October 2, 2003 Hey folks, I'm trying to use the RichTextBox in my application. The problem is that I would like it to scroll line-by-line normally, instead of the default smooth scrolling. Does anyone know how this might be accomplished? I've searched the forums, google, codeproject, etc and found nothing.. so it's either difficult or so blindingly obvious that noone mentions it :) Thanks, -- Pete Quote
pjv Posted October 4, 2003 Author Posted October 4, 2003 *sigh* I'm rapidly coming to the conclusion that there's no way of doing this. Very annoying as TextBox seems to scroll normally, but RichTextBox insists on doing it smoothly. -- Pete Quote
AlexCode Posted October 6, 2003 Posted October 6, 2003 I've found this method: Me.RichTextBox1.ScrollToCaret(). Scrolls the contents of the control to the current caret position. [Visual Basic] Public Sub ScrollToCaret() [C#] public void ScrollToCaret(); [C++] public: void ScrollToCaret(); [JScript] public function ScrollToCaret(); Remarks This method enables you to scroll the contents of the control until the caret is within the visibile region of the control. If the caret is positioned below the visible region of the control, the ScrollToCaret method will scroll the contents of the control until the caret is visible at the bottom of the control. If the caret is positioned above the visible region of the control, this method scrolls the contents of the control until the caret is visible at the top of the control. You can use this method in a multiline text box to ensure that the current text entry point is within the visible region of the control. Note This method has no effect if the control does not have focus or if the caret is already positioned in the visible region of the control. The only thing you have to work out is to position the 'caret' one line up or down and override the VScroll Event... It's not that nice coding but if you really want it... :D It's the best I can do for you ! Quote Software bugs are impossible to detect by anybody except the end user.
pjv Posted October 6, 2003 Author Posted October 6, 2003 I suppose it's possible to override VScroll and WndProc (for the scroll messages that don't seem to make it to VScroll)... I was hoping for a better solution though (like a simple API call or something to set an option for richedit). Ah well. -- Pete Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.