8,834
社区成员
发帖
与我相关
我的任务
分享
public partial class UserControl1 : UserControl
{
public delegate void RefreshWindowHandler();
public event RefreshWindowHandler OnRefreshWindow;
public UserControl1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form frm = new Form();
frm.FormClosing += (sender1, e1) => { if (OnRefreshWindow != null) { OnRefreshWindow(); } };
frm.Show();
}
}
this.userControl11.OnRefreshWindow += () => { MessageBox.Show("刷新窗体"); };