如何同时滚动两个文本框

时间:2019-03-14 11:42:59

标签: vb.net

这里的目标是在滚动richtextbox2的同时滚动richtextbox2。 我尝试过...

Dim currentLine As integer=0
Dim index As integer=0

Private sub richtextbox1_textChanged(s as sender,e as eventArgs)handles richtextbox1.textChanged
index=richtextbox1.selectionStart
currentLine=richtextbox.GetLineFromCharIndex(index)
End sub

 Private sub richtextbox1_vscroll()  handlesrichtextbox.vscroll
Dim i=currentLine+1
Richtextbox2.select(i,1)
Richtextbox2.scrollToCaret()
End sub

0 个答案:

没有答案