利用线程的方法 做延时 不卡界面

Thread t = new Thread(o => Thread.Sleep(500));
                    t.Start(this);
                    while (t.IsAlive)
                    {
                        Application.DoEvents();
                    }

 不用线程 也可以这样不卡界面 

public static void Delay(int mm)
        {
            DateTime current = DateTime.Now;
            while (current.AddMilliseconds(mm) > DateTime.Now)
            {
                Application.DoEvents();
            }
            return;
        } 

 

posted @ 2018-01-24 18:40  大漠苍狼~  阅读(568)  评论(0)    收藏  举报