|
发表于 2021-3-11 18:45:01
|
显示全部楼层
或者:
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("光标指到第几行", "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 & "行")
Next
RichTextBox1.Text = Join(arr, vbCrLf)
End Sub
|
|