110,539
社区成员
发帖
与我相关
我的任务
分享
//form2
//定义委托
public delegate void Save();
//定义事件
public event Save OnSave;
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
OnSave();
}
//form1
private void button1_Click(object sender, EventArgs e)
{
Form2 frm = new Form2();
frm.OnSave += new Form2.Save(frm_OnSave);
frm.ShowDialog();
}
void frm_OnSave()
{
MessageBox.Show("此处实现在form2点击按钮后的方法!");
}