| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 792 人关注过本帖
标题:关于红绿灯交通模拟程序的一些问题,我有点困惑!
取消只看楼主 加入收藏
jack123son
Rank: 1
等 级:新手上路
帖 子:30
专家分:5
注 册:2011-10-8
结帖率:30%
收藏
 问题点数:0 回复次数:0 
关于红绿灯交通模拟程序的一些问题,我有点困惑!
大家帮我看看这个红绿灯交通模拟程序,里面的时间怎么设置才能正确呢?

我想模仿现实生活中的十字路口的红绿灯程序,但是时间我把握不好,希望能得到高人的指点!我用的是Visual Studio 2005!


Public Class Form1

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick '每2秒钟显示绿灯
        PictureBox1.Visible = False '红灯不亮
        PictureBox3.Visible = False '红灯不亮
        PictureBox2.Visible = True '绿灯亮
        PictureBox4.Visible = True '绿灯亮
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Timer1.Enabled = False
        Timer1.Interval = 2000
        Timer2.Interval = 7000
        Timer2.Enabled = False
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Timer1.Enabled = True
        Timer2.Enabled = True
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Timer1.Enabled = False
        Timer2.Enabled = False
        PictureBox1.Visible = True
        PictureBox2.Visible = True
        PictureBox3.Visible = True
        PictureBox4.Visible = True
    End Sub

    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick '每7秒钟显示红灯
        PictureBox1.Visible = True
        PictureBox3.Visible = True
        PictureBox2.Visible = False
        PictureBox4.Visible = False

    End Sub
End Class

我还想问问,这个论坛怎么都不能上传附件了呢?图片也不能上传啊?
搜索更多相关主题的帖子: 红绿灯 交通 False 
2012-05-29 21:32
快速回复:关于红绿灯交通模拟程序的一些问题,我有点困惑!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016884 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved