问题描述:

I have two rich textboxs compareing data with very little changes between them.

I would like them to scroll together.

The scrolling must be synchronized. can any one show me how i would go about this?

Thanks

网友答案:

Try this:

Check this Link 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);
    }
}
相关阅读:
Top