猿问

C#中如何使用Sleep

RT

慕神8447489
浏览 1236回答 2
2回答

动漫人物

using System;using System.Windows.Forms;using System.Threading;namespace MyProject{public class Util{//延时函数public static void Delay(int DelayTime = 100){int time = Environment.TickCount;while (true){if (Environment.TickCount - time >= DelayTime){break;}Application.DoEvents();Thread.Sleep(10);}}}}

慕的地6264312

System.Threading.Thread.Sleep(5000); //括号里是毫秒,所以5000毫秒为1秒就是说程序在运行到这了以后,会先待机5秒再继续
随时随地看视频慕课网APP
我要回答