Autoscroll in C# RichTextBox
using System.Runtime.InteropServices;
#region WinAPI//WinAPI-Declaration for SendMessage
[DllImport("user32.dll")]
public static extern IntPtr SendMessage(IntPtr window, int message, int wparam, int lparam);const int WM_VSCROLL = 0x115;const int SB_BOTTOM = 7;#endregionSendMessage(richTextBox1.Handle, WM_VSCROLL, SB_BOTTOM, 0);
That is a much better solution than the ScrollToCaret() method that many people use.
ReplyDeleteI have wrapped it in a class for people that are unfamiliar with the whole WinAPI thing.