当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - 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

网友答案:

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);
    }
}
分享给朋友:
您可能感兴趣的文章:
随机阅读: