zoukankan      html  css  js  c++  java
  • C#中倒计时汇总

    一:

    int time=0;
    while(true){
    Thread. Sleep(1000);
    time=time+1;
    Console.Write(time)
    if(time>=180){
    //这里放时间到了之后执行的操作,会被循环执行。
    //不想循环请加break;
    }
    }

    二:

    Task.Factory.StartNew(() =>
                            {
                                boolTimeDown = true;
                                int time = 0;
                                while (boolTimeDown)
                                {
                                    Thread.Sleep(1000);
                                    time = time + 1;
                                    Console.Write(time);
                                    if (time <= 60)
                                    {
                                        LblGetCode.Text = "剩余" + Convert.ToString(60 - time) + "秒";
                                    }
                                    else
                                    {
                                        LblGetCode.Text = "获取验证码";
                                        boolTimeDown = false;
                                        break;
                                    }
                                }
                            });

  • 相关阅读:
    Assignment 1-3 :Pattern Recognition
    GDB Guide
    Java 进阶
    Lab 4: Cache Geometries
    Buffer Overflows Lab
    二进制炸弹Lab
    Assignment 1-2 :Randomized Queues
    Assignment 1 :Percolation
    CSAPP Chapter 2
    在win7下用U盘安装Ubuntu,实现双系统
  • 原文地址:https://www.cnblogs.com/FLWL/p/8531131.html
Copyright © 2011-2022 走看看