RichTextBox Control supporting synchronous scrolling

Source: Internet
Author: User
Using system. windows. forms; public class synchronizedscrollrichtextbox: system. windows. forms. richTextBox {public synchronizedscrollrichtextbox synchronized {Get; set;} public const int wm_vscroll = 0x115; Public const int em_linescroll = 0xb6; protected override void wndproc (Ref system. windows. forms. message MSG) {If (MSG. MSG = wm_vscroll | MSG. MSG = em_linescroll) {If (synchronized! = NULL) {message = MSG; message. hwnd = synchronized. handle; synchronized. pubwndproc (ref message) ;}} base. wndproc (ref MSG);} public void pubwndproc (Ref system. windows. forms. message MSG) {base. wndproc (ref MSG );}}

I have referenced many documents in Chinese and English, but they are not completely complete. Therefore, it is hard to calculate originality.

My blog has always been simple and clear.CodeTo your project. Compile it once and drag it to the form. For example:

drag two instances and set the synchronized attribute is the peer. Run, the two text boxes can be associated.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.