如下图
1)设置滚动条的Max属性和Min属性。在上图分别设置为Max = 100, Min=0
2)设置滚动条的Value属性。这个值确定滑块的位置
据此,滚动条的设置代码为
Option Explicit
Private Sub Form_Load()
With HScroll1
.Min = 0
.Max = 100
.Value = 50
End With
End Sub
Private Sub Form_Load()
HScroll1.Value = 200 '定义初始值
Timer1.Interval = HScroll1.Value
End Sub
Private Sub Timer1_Timer()
If Label1.Left + Label1.Width < Form1.Width Then
Label1.Left = Label1.Left = 300
Else
Label1.Left = 0
End If
Timer1.Interval = HScroll1.Value
End Sub
你调试一下吧,我没VB给你调试,有问题留言
Private Sub HScroll1_Change()
HScroll1.min = 0
HScroll1.max = 1000
HScroll1.SmallChange = 100
HScroll1.LargeChange = 200
Timer1.Interval = HScroll1.Value
End Sub
Private Sub Timer1_Timer()
Label1.Left = Label1.Left + 300
If Label1.Left >= Me.Width Then Label1.Left = 0
End Sub