我有两种形式,主要和儿童。在主窗体上单击按钮时,将加载子窗体。通过订阅子表单的已结束事件,可以在主表单中捕获子表单吗?
答案 0 :(得分:14)
是的,你可以,这很简单:
private void LoadChildForm_Click(object sender, EventArgs e)
{
ChildForm form = new ChildForm();
form.FormClosed += new FormClosedEventHandler(ChildFormClosed);
form.Show();
}
void ChildFormClosed(object sender, FormClosedEventArgs e)
{
// do something useful
}