vb6.0 richtextbox滚动条问题

来源:百度知道 编辑:UC知道 时间:2024/06/15 20:26:23
richtextbox有自带的滚动条,怎样让竖直滚动条自动向下滚呢??在timer的事件里写什么啊?在线等,先谢谢啦....

Const EM_LINESCROLL = &HB6
Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

Private Sub Form_Load()
Timer1.Enabled = True
Timer1.Interval = 1000
End Sub

Private Sub Timer1_Timer()
SendMessageLong RichTextBox1.hwnd, EM_LINESCROLL, 0, 1
End Sub

Private Sub Form_Load()
Timer1.Interval = 1000
Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
For i = RichTextBox1.SelStart To Len(RichTextBox1.Text)
If Mid(RichTextBox1.Text, i, 1) = Chr(13) Then
RichTextBox1.SelStart = i + 1
Exit For
End If
Next i
End Sub