还是昨天提问的问题,分别单击两个单选按钮“左、右”控制字母左右单方向移动,而不是自动移动。麻烦你了! 5
1个回答
展开全部
Dim x As Long
Private Sub Form_Load()
HScroll1.Max = 500
HScroll1.Min = 0
HScroll1.SmallChange = 10
HScroll1.LargeChange = 50
HScroll1.Value = 20
Timer1.Interval = 50
Label1.Caption = "A"
Timer1.Enabled = False
End Sub
Private Sub HScroll1_Change()
Dim s As Integer
s = IIf(x = 0, 1, Sgn(x))
x = HScroll1.Value * s
End Sub
Private Sub Option1_Click()
Timer1.Enabled = True
x = Abs(x)
End Sub
Private Sub Option2_Click()
Timer1.Enabled = True
x = -x
End Sub
Private Sub Timer1_Timer()
Label1.Left = Label1.Left + x
If Label1.Left <= 0 Then Timer1.Enabled = False
If Label1.Left + Label1.Width > Me.Width Then Timer1.Enabled = False
End Sub
Private Sub Form_Load()
HScroll1.Max = 500
HScroll1.Min = 0
HScroll1.SmallChange = 10
HScroll1.LargeChange = 50
HScroll1.Value = 20
Timer1.Interval = 50
Label1.Caption = "A"
Timer1.Enabled = False
End Sub
Private Sub HScroll1_Change()
Dim s As Integer
s = IIf(x = 0, 1, Sgn(x))
x = HScroll1.Value * s
End Sub
Private Sub Option1_Click()
Timer1.Enabled = True
x = Abs(x)
End Sub
Private Sub Option2_Click()
Timer1.Enabled = True
x = -x
End Sub
Private Sub Timer1_Timer()
Label1.Left = Label1.Left + x
If Label1.Left <= 0 Then Timer1.Enabled = False
If Label1.Left + Label1.Width > Me.Width Then Timer1.Enabled = False
End Sub
来自:求助得到的回答
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询