简单一点这样试试
private void button1_Click(object sender, System.EventArgs e)
{
MethodInvoker mi = new MethodInvoker(addlist);
mi.BeginInvoke(null,null);
} void addlist()
{
for(int i =0;i<200000;i++)
{
listBox1.Items.Add(i.ToString());
}
}

解决方案 »

  1.   

    @xoaoz() 
    不行呀,错误如下:你测试一下吧
    线程间操作无效: 从不是创建控件“listBox1”的线程访问它。
      

  2.   

    在MSDN上查找“线程安全性, 调用控件 [Windows 窗体]”
    private void setTextUnsafeBtn_Click(
        object sender, 
        EventArgs e)
    {
        this.demoThread = 
            new Thread(new ThreadStart(this.ThreadProcUnsafe));    this.demoThread.Start();
    }// This method is executed on the worker thread and makes
    // an unsafe call on the TextBox control.
    private void ThreadProcUnsafe()
    {
        this.textBox1.Text = "This text was set unsafely.";
    }private void setTextSafeBtn_Click(
        object sender, 
        EventArgs e)
    {
        this.demoThread = 
            new Thread(new ThreadStart(this.ThreadProcSafe));    this.demoThread.Start();
    }// This method is executed on the worker thread and makes
    // a thread-safe call on the TextBox control.
    private void ThreadProcSafe()
    {
        this.SetText("This text was set safely.");
    }private void SetText(string text)
    {
        // InvokeRequired required compares the thread ID of the
        // calling thread to the thread ID of the creating thread.
        // If these threads are different, it returns true.
        if (this.textBox1.InvokeRequired)
        {    
            SetTextCallback d = new SetTextCallback(SetText);
            this.Invoke(d, new object[] { text });
        }
        else
        {
            this.textBox1.Text = text;
        }
    }
    private void setTextBackgroundWorkerBtn_Click(
        object sender, 
        EventArgs e)
    {
        this.backgroundWorker1.RunWorkerAsync();
    }// This event handler sets the Text property of the TextBox
    // control. It is called on the thread that created the 
    // TextBox control, so the call is thread-safe.
    //
    // BackgroundWorker is the preferred way to perform asynchronous
    // operations.private void backgroundWorker1_RunWorkerCompleted(
        object sender, 
        RunWorkerCompletedEventArgs e)
    {
        this.textBox1.Text = 
            "This text was set safely by BackgroundWorker.";
    }
      

  3.   

    winform中,多线程中的非主线程无法操作windows窗体上的控件,上面正解
      

  4.   

    用了 backgroundWorker来处理。
    而不是建立委托。
    其里头 backgroundWorker也是用委托处理的。