Pomster
Pomster

Reputation: 15197

Dual Scrolling of two rich textboxs

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

Upvotes: 0

Views: 228

Answers (1)

Vinod
Vinod

Reputation: 4892

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);
    }
}

Upvotes: 2

Related Questions