天天看點

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

繼續閱讀