VB题目:使用定时器模拟交通红绿灯,红绿黄三种灯交替变换形成动画效果.高人帮我编编吧
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/20 07:21:05
VB题目:使用定时器模拟交通红绿灯,红绿黄三种灯交替变换形成动画效果.高人帮我编编吧
VB题目:使用定时器模拟交通红绿灯,红绿黄三种灯交替变换形成动画效果.高人帮我编编吧
VB题目:使用定时器模拟交通红绿灯,红绿黄三种灯交替变换形成动画效果.高人帮我编编吧
Option Explicit
Dim nCount As Integer
Private Const T_Inteval As Integer = 500 '延时(1拍数)
Private Const R_DELAY As Integer = 20 '红延时拍数
Private Const Y_DELAY As Integer = 10 '黄延时拍数
Private Const G_DELAY1 As Integer = 10 '绿延时1拍数
Private Const G_DELAY2 As Integer = 10 '绿延时2拍数
Private Sub Form_Load()
'Shape1.FillColor = &HFF&
'Shape2.FillColor = &HFFFF&
'Shape3.FillColor = &HFF00&
Shape1.FillColor = &H40&
Shape2.FillColor = &H4040&
Shape3.FillColor = &H4000&
nCount = 0
Timer1.Interval = T_Inteval
End Sub
Private Sub Timer1_Timer()
nCount = nCount + 1
If nCount > 0 And nCount R_DELAY + Y_DELAY And nCount