C#
1. 等待一段时间,等待的过程中timer等可以响应
DateTime Tthen = DateTime.Now;
do
{
Application.DoEvents();
} while (Tthen.AddSeconds(5) > DateTime.Now);
2. settimeout;一段时间结束后,执行某段代码: