请看如下:
using System.Diagnostics;
using System.Runtime.InteropServices;
[DllImport("kernel32.dll")]
static extern uint GetTickCount();
static void Delay(uint ms)
{
uint start = GetTickCount();
while(GetTickCount() - start <ms)
{
Application.DoEvents();
}
}
使用方法如下:
uint ms = 200;
Delay(ms);
大家猜猜这个有什么用?咔咔咔,简直就是优雅至极!