Main Form
namespace cp5
{
public delegate void dHide(bool hide);
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}
void Button1Click(object sender, EventArgs e)
{
Form1 fm1=new Form1();
fm1.delfunc+=hideform;
fm1.Show();
}
void hideform(bool hide)
{
if (hide) this.Hide();
else this.Show();
}
}
}
and child form to hide/show main form:
namespace cp5
{
public partial class Form1 : Form
{
public dHide delfunc=null;
public Form1()
{
InitializeComponent();
}
void Button1Click(object sender, EventArgs e)
{
delfunc(true);
}
void Button2Click(object sender, EventArgs e)
{
delfunc(false);
}
}
}