VB编程:Timer控件中使用计数变量
运行效果:
程序代码:
Private myint As Integer
Private Sub Form_Load()
myint = 0
End Sub
Private Sub Timer1_Timer()
myint = myint + 1
If myint = 2 Then Me.BackColor = vbGreen
If myint = 4 Then Me.BackColor = vbRed
If myint = 6 Then Me.BackColor = vbBlue
If myint = 10 Then myint = 0
End Sub