这个可能要看你在for循环里干什么了

解决方案 »

  1.   

    用计时器比较好吧
    DoLoop(int start,int end){//do the loop
    }main(){
    //...
    t1 = new Thread(new ThreadStart(DoLoop(0,50)));//t1 is a global Thread.
    t1.start();
    timer.start();//timer is a Timer with an interval of 10000ms
    }timer_click(...){//occurs when the first 10000ms passed
    timer.Stop();
    t1.Abort();
    DoLoop(51,100);
    }
      

  2.   

    to bacon_1982(烟火) 
    线程可以传参数吗?
      

  3.   

    while(p==1)
    {
    p=p+t;
    this.Character.Show(null);
    string s="您已经连续使用电脑"+p+"分钟了,好男儿提醒您该注意保护一下您的眼睛了:)";
    //精灵说话
    Character.Speak(s,null);
    int i=6000;
    System.Threading.Thread.Sleep(i);
    t++;
    break;
    }
      

  4.   

    你也可以用一个func(void)来做这件事情啊只是Doloop函数不可以重用罢了
      

  5.   

    delegate void dl();
    bool exit = false;
    private void button1_Click(object sender, System.EventArgs e)
    {
    dl d=new dl(this.DoLoop);
    for (int i = 0; i<100; i++)
    {
    exit = false;
    IAsyncResult ia = d.BeginInvoke(null,null);
    ia.AsyncWaitHandle.WaitOne(10000,true);
    exit = true;
    System.Threading.Thread.Sleep(10);
    }
    }
    private void DoLoop()
    {
    for (int i = 0; i<100000; i++)
    {
    if (exit)
    {
    return;
    }
    System.Threading.Thread.Sleep(10);
    }
    }