VB题目:使用定时器模拟交通红绿灯,红绿黄三种灯交替变换形成动画效果.高人帮我编编吧
来源:学生作业帮助网 编辑:作业帮 时间:2024/08/30 07:25:58
![VB题目:使用定时器模拟交通红绿灯,红绿黄三种灯交替变换形成动画效果.高人帮我编编吧](/uploads/image/z/8948537-17-7.jpg?t=VB%E9%A2%98%E7%9B%AE%EF%BC%9A%E4%BD%BF%E7%94%A8%E5%AE%9A%E6%97%B6%E5%99%A8%E6%A8%A1%E6%8B%9F%E4%BA%A4%E9%80%9A%E7%BA%A2%E7%BB%BF%E7%81%AF%2C%E7%BA%A2%E7%BB%BF%E9%BB%84%E4%B8%89%E7%A7%8D%E7%81%AF%E4%BA%A4%E6%9B%BF%E5%8F%98%E6%8D%A2%E5%BD%A2%E6%88%90%E5%8A%A8%E7%94%BB%E6%95%88%E6%9E%9C.%E9%AB%98%E4%BA%BA%E5%B8%AE%E6%88%91%E7%BC%96%E7%BC%96%E5%90%A7)
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