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.