0

我有两个富文本框比较数据,它们之间的变化很小。

我希望他们一起滚动。

滚动必须同步。谁能告诉我我会怎么做?

谢谢

4

1 回答 1

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);
    }
}
于 2012-06-06T06:38:24.077 回答