父窗口的定义
namespace
Test
{
public delegate void ChildClose();
public partial class Parent : Form
{
private void btnLogIn_Click(object sender, EventArgs e)
{
Chield ch = new Chield();
ch.closeFather += new ChildClose(this.Close);
ch.Show();
this.Visible = false;
}
}
}
子窗口的定义:
{
public delegate void ChildClose();
public partial class Parent : Form
{
private void btnLogIn_Click(object sender, EventArgs e)
{
Chield ch = new Chield();
ch.closeFather += new ChildClose(this.Close);
ch.Show();
this.Visible = false;
}
}
}
namespace
Test
{
public partial class Chield : Form
{
public event ChildClose closeFather;
public Chield ()
{
InitializeComponent();
}
private void Chield_FormClosed(object sender, FormClosedEventArgs e)
{
closeFather();
}
}
}
{
public partial class Chield : Form
{
public event ChildClose closeFather;
public Chield ()
{
InitializeComponent();
}
private void Chield_FormClosed(object sender, FormClosedEventArgs e)
{
closeFather();
}
}
}