Wednesday, 10 December 2008

Autoscroll in C# RichTextBox

using System.Runtime.InteropServices;
#region WinAPI
//WinAPI-Declaration for SendMessage
public static extern IntPtr SendMessage(
IntPtr window, int message, int wparam, int lparam);
const int WM_VSCROLL = 0x115;
const int SB_BOTTOM = 7;
SendMessage(richTextBox1.Handle, WM_VSCROLL, SB_BOTTOM, 0);

1 comment:

Jakob said...

That is a much better solution than the ScrollToCaret() method that many people use.

I have wrapped it in a class for people that are unfamiliar with the whole WinAPI thing.

Post a Comment