Private Const LB_GETTOPINDEX = &H18E
Private Const LB_SETTOPINDEX = &H197
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Sub Command1_Click()
'使用api滚动10行
Dim topindex As Long
topindex = SendMessage(List1.hwnd, LB_GETTOPINDEX, 0&, 0&)
Debug.Print topindex
topindex = topindex + 10
SendMessage List1.hwnd, LB_SETTOPINDEX, topindex, 0&
End Sub
Private Sub Command2_Click()
'使用vb代码滚动10行
List1.topindex = List1.topindex + 10
End Sub
Private Sub Form_Load()
Dim i As Long
For i = 1 To 100
Me.List1.AddItem "line " + CStr(i)
Next
End Sub