我有两个比较数据的富文本框,它们之间的变化非常小。
我希望他们一起滚动。
必须同步滚动。谁能告诉我怎么会这样呢?
由于
答案 0 :(得分:2)
试试这个:
点击此链接Synchronized-RichTextBox-objects-or-how-to-scroll
public class SynchronizedScrollRichTextBox : System.Windows.Forms.RichTextBox
{
public event vScrollEventHandler vScroll;
public delegate void vScrollEventHandler(System.Windows.Forms.Message message);
public const int WM_VSCROLL = 0x115;
protected override void WndProc(ref System.Windows.Forms.Message msg)
{
if (msg.Msg == WM_VSCROLL)
{
if (vScroll != null)
{
vScroll(msg);
}
}
base.WndProc(ref msg);
}
public void PubWndProc(ref System.Windows.Forms.Message msg)
{
base.WndProc(ref msg);
}
}