110,566
社区成员
发帖
与我相关
我的任务
分享
for(i=0;i<1000;i++)
{
//执行代码每次估计10秒钟
.......
}
using System.Threading;
System.Threading.Thread _t;
private void btnStart_Click(object sender, EventArgs e)
{
_t = new Thread(new ThreadStart(run));
_t.Start();
}
private void run()
{
for (int i = 0; i < 1000000; i++)
{
Console.WriteLine(i);
}
}
//暂停
private void btnSuspend_Click(object sender, EventArgs e)
{
_t.Suspend();
}
//继续
private void btnResume_Click(object sender, EventArgs e)
{
_t.Resume();
}