form1上放置Command1,Timer1,Picture1(装入一个)
Dim MoveStep As Integer
Private Sub Command1_Click()
Timer1Enabled = False
End Sub
Private Sub Form_Load()
MoveStep = 100
End Sub
Private Sub Timer1_Timer()
If Picture1Left + Picture1Width + 30 > Form1Width Then
MoveStep = -100
End If
If Picture1Left < 0 Then
MoveStep = 100
End If
Picture1Left = Picture1Left + MoveStep
End Sub
Option Explicit
Private Sub Form_Load()
Randomize
Label1Caption = Int((Rnd (999999 - 100000 + 1)) + 100000) '生成100000-999999之间的随机数
Timer1Interval = 1000 '一秒一次
Timer1Enabled = True
End Sub
Private Sub Timer1_Timer()
Static n As Integer
n = n + 1
If n = 60 Then '一秒一次,累加到60此即60秒
n = 0
Randomize
Label1Caption = Int((Rnd (999999 - 100000 + 1)) + 100000)
End If
End Sub
有问题请追问,,加油!
欢迎分享,转载请注明来源:表白网
评论列表(0条)