VB的listbox如何实现自动滚动?

来源:百度知道 编辑:UC知道 时间:2024/05/16 06:17:25
VB的listbox如何实现自动滚动?
看来我表达得不是很清楚
就是输入数据是listbox

添加一个Timer1控件

Private Sub Timer1_Timer()
If List1.TopIndex < List1.ListCount - 1 Then
List1.TopIndex = List1.TopIndex + 1 '-1
Else
List1.TopIndex = List1.List(0)
End If
End Sub

向下滚动: List1.TopIndex = List1.TopIndex + 1
向上滚动: List1.TopIndex = List1.TopIndex - 1

或者使用API函数来实现。