[求助]LABEL控件移动问题
大家好,这几天我做了一个程序,以实现五个LABEL控件在窗体上,像桌球一样弹来弹去,就像一些网站上的浮动广告,代码如下:
Dim a As Integer, b As Integer
Private Sub lo(pic As PictureBox)
Dim p As Integer, q As Integer
If pic.Left < 0 Then
a = 1
End If
If pic.Left > Form1.Width - Picture1(0).Width Then
a = 2
End If
If pic.Top < 0 Then
b = 1
End If
If pic.Top > Form1.Height - Picture1(0).Height Then
b = 2
End If
If a = 1 Then
p = pic.Left + 30
End If
If a = 2 Then
p = pic.Left - 30
End If
If b = 1 Then
q = pic.Top + 30
End If
If b = 2 Then
q = pic.Top - 30
End If
pic.Move p, q
End Sub
Private Sub Form_Load()
Timer1.Enabled = True
a = 1: b = 2
End Sub
Private Sub Timer1_Timer()
Call lo(Picture1(0))
Call lo(Picture1(1))
Call lo(Picture1(2))
Call lo(Picture1(3))
Call lo(Picture1(4))
End Sub
Call lo(Picture1(2))
Call lo(Picture1(3))
Call lo(Picture1(4))
分别分配进去,但还不行,效果一样,不知道怎么办了,请各位帮个忙啊。