用Control.Invoke()方法:
Form1里加上如下内容
public delegate void AddListItem(String myString);
public AddListItem myDelegate;
public Form1()
{
myDelegate = new AddListItem(AddListItemMethod);
}
public void AddListItemMethod(String myString)
{
myListBox.Items.Add(myString);
}
Test类加如下代码:
Form1 myForm;
public Test(Form1 form)
{
myForm = form;
}
public void CreateList()
{
myForm.Invoke(myFormControl1.myDelegate,new Object[] );
}
原理就是这样,具体实现你自已修改吧
修改控件的Modifiers属性为Public