|
or:
Option Explicit
Const EM_LINESCROLL =&HB6
Private Declare Function SendMessage Lib "User32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Long) As Long
Private Sub Command1_Click()
RichTextBox1.SetFocus
RichTextBox1.SelStart = 0
Randomize
Dim n As Long
n = CLng(InputBox("How many lines the cursor points to", "info", Int(Rnd * 100)))-1
SendMessage RichTextBox1.hWnd, EM_LINESCROLL, 0, n&
End Sub
Private Sub Form_Load()
Dim i As Long, arr(1 To 500) As String
For i = 1 To 500
arr(i) = IIf(i Mod 9> 7, "", "第"&i&"line")
Next
RichTextBox1.Text = Join(arr, vbCrLf)
End Sub |
|