//一个Button和textbox1
private void button1_Click(object sender, EventArgs e)
{
Form2 t = new Form2();
//给窗体二EvnSend注册(注册事件为窗体二委托(委托实例化:指向本窗体t_send))
t.EvnSend += new Form2.send(t_send);
t.Show();
}
//为了证明不是调用,设为私有
private void t_send(string mess)
{
textBox1.Text = mess;
}
public delegate void send(string mess);//声明一个委托
public event send EvnSend;//声明一个事件指向委托
//在窗体启动中为该事件注册为Form1.textBox1赋值
private void button1_Click(object sender, EventArgs e)
{
EvnSend(textBox1.Text);//事件调用
}