110,533
社区成员
发帖
与我相关
我的任务
分享
class Test{
public Form1 form;
public string process4(string s2,string s3)
{
return s2 + s3 + form.TextBox1.Text;
}
}
class Form1:Form
{
private void button1_Click(object sender, EventArgs e)
{
/* 调用方法 */
Test t = new Test();
t.form=this;
string r1 = t.Process("Text1", "Text2", new ProcessDelegate(t.Process1));
string r2 = t.Process("Text1", "Text2", new ProcessDelegate(t.Process2));
string r3 = t.Process("Text1", "Text2", new ProcessDelegate(t.Process3));
textBox1.Text = r1 + "|" + r2 + "|" + r3;
}
}
在编程语言里,任何对象都没什么特殊性,TextBox是,Form也是,想要访问先传递引用参数。。。