【C#】延时

在线程While中使用Thread.Sleep导致界面卡顿,替代方案:

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

 参考:https://blog.csdn.net/CatchMe_439/article/details/88548680

posted @ 2023-09-16 14:45  不溯流光  阅读(98)  评论(0编辑  收藏  举报