C#不允许直接从线程中访问Form里的控件,比如希望在线程里修改Form里的一个TextBox的内容等等,唯一的做法是使用Invoke方法,下面是一个MSDN里的Example,很说明问题: using System; using System.Drawing; using System.Windows.Forms; using System.Threading; public class MyFormControl:Form ... {publicdelegatevoidAddListItem(StringmyString);publicAddListItemmyDelegate;privateButtonmyButton;privateThreadmyThread;privateListBoxmyListBox;publicMyFormControl()...{myButton=newButton();myListBox=newListBox();myButton.Location=newPoint(72,160);myButton.Size=newSize(152,32);myButton.TabIndex=1;myButton.Text="Additemsinlistbox";myButton.Click+=newEventHandler(Button_Click);myListBox.Location=newPoint(48,32);myListBox.Name="myListBox";myListBox.Size=newSize(200,95);myListBox.TabIndex=2;ClientSize=newSize(292,273);Controls.AddRange(newControl[]...{myListBox,myButton});Text="'Control_Invoke'example";myDelegate=newAddListItem(AddListItemMethod);}staticvoidMain()...{MyFormControlmyForm=newMyFormControl();myForm.ShowDialog();}publicvoidAddListItemMethod(StringmyString)...{myListBox.Items.Add(myString);}privatevoidButton_Click(objectsender,EventArgse)...{myThread=newThread(newThreadStart(ThreadFunction));myThread.Start();}privatevoidThreadFunction()...{MyThreadClassmyThreadClassObject=newMyThreadClass(this);myThreadClassObject.Run();}} public class MyThreadClass ... {MyFormControlmyFormControl1;publicMyThreadClass(MyFormControlmyForm)...{myFormControl1=myForm;}StringmyString;publicvoidRun()...{for(inti=1;i<=5;i++)...{myString="Stepnumber"+i.ToString()+"executed";Thread.Sleep(400);//Executethespecifieddelegateonthethreadthatowns//'myFormControl1'control'sunderlyingwindowhandlewith//thespecifiedlistofarguments.myFormControl1.Invoke(myFormControl1.myDelegate,newObject[]...{myString});}}}