标题:计时器问题
取消只看楼主
longdunxiong
Rank: 2
等 级:论坛游民
帖 子:8
专家分:20
注 册:2012-2-21
 问题点数:0 回复次数:3 
计时器问题
C# 中的计时器 怎么让一个计时器先执行完了之后,再让第二个执行
搜索更多相关主题的帖子: 计时器 
2012-02-23 09:59
longdunxiong
Rank: 2
等 级:论坛游民
帖 子:8
专家分:20
注 册:2012-2-21
得分:0 
谢谢
2012-02-23 19:40
longdunxiong
Rank: 2
等 级:论坛游民
帖 子:8
专家分:20
注 册:2012-2-21
得分:0 
嗯 ,  呵呵   我已经做好了
2012-03-03 17:50
longdunxiong
Rank: 2
等 级:论坛游民
帖 子:8
专家分:20
注 册:2012-2-21
得分:0 
using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace T6.红绿灯
{
    public partial class frmRedGreen2 : Form
    {
        int red, yello, green, count = 0;

        public frmRedGreen2()
        {
            InitializeComponent();
        }

        private void frmRedGreen2_Load(object sender, EventArgs e)
        {
            pbImage.Image=imageL.Images[0];
        }

        private void button1_Click(object sender, EventArgs e)
        {
            red=Convert.ToInt32(txtRed.Text.ToString());
            
            yello = Convert.ToInt32(txtYello.Text.ToString());

            green = Convert.ToInt32(txtGreen.Text.ToString());
        }
        private void btnStart_Click(object sender, EventArgs e)
        {
            Time.Enabled = true;
            count = red;
            
        }
        private void Time_Tick(object sender, EventArgs e)
        {
            pbImage.Image = imageL.Images[1];
            lblTime.Text = count.ToString();
            count--;
            if (count==0)
            {
                Time1.Enabled = true;
                Time.Enabled = false;
                count = yello;
            }
        }

        private void Time1_Tick(object sender, EventArgs e)
        {
            pbImage.Image = imageL.Images[2];
            lblTime.Text = count.ToString();
            count--;
            if (count == 0)
            {
                Time2.Enabled = true;
                Time1.Enabled = false;
                count = green;
            }
        }

        private void Time2_Tick(object sender, EventArgs e)
        {
            pbImage.Image=imageL.Images[3];
            lblTime.Text = count.ToString();
            count--;
            if (count == 0)
            {
                Time.Enabled = true;
                Time2.Enabled = false;
                count = red;
            }
        }

        private void btbStop_Click(object sender, EventArgs e)
        {
            Time.Enabled = false;
            Time1.Enabled = false;
            Time2.Enabled = false;
        }

      


    }
}
2012-03-06 20:20



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-361430-1-1.html




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

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