"控制元件一個shape1,一個timer1
Private Sub Form_Load()
Timer1.Interval = 100
Timer1.Enabled = True
Shape1.Shape = 3
Shape1.BackStyle = 1
Shape1.BackColor = vbGreen
End Sub
Private Sub Timer1_Timer()
Static n As Integer
Select Case n
Case 1 To 50
Case 51 To 80, 131 To 160
If n Mod 2 = 1 Then
Shape1.BackColor = vbYellow
Else
Shape1.BackStyle = 0
End If
If n = 160 Then n = 0
Case 81 To 130
Shape1.BackColor = vbRed
End Select
n = n + 1
"控制元件一個shape1,一個timer1
Private Sub Form_Load()
Timer1.Interval = 100
Timer1.Enabled = True
Shape1.Shape = 3
Shape1.BackStyle = 1
Shape1.BackColor = vbGreen
End Sub
Private Sub Timer1_Timer()
Static n As Integer
Shape1.BackStyle = 1
Select Case n
Case 1 To 50
Shape1.BackColor = vbGreen
Case 51 To 80, 131 To 160
If n Mod 2 = 1 Then
Shape1.BackColor = vbYellow
Else
Shape1.BackStyle = 0
End If
If n = 160 Then n = 0
Case 81 To 130
Shape1.BackColor = vbRed
End Select
n = n + 1
End Sub