窗口1
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public Form2 form2 = null;
private void button1_Click(object sender, EventArgs e)
{
this.Hide();
if(form2 == null)
{
form2 = new Form2();
}
form2.Owner = this;
form2.Show();
}
}
窗口2
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
this.Hide();
this.Owner.Show();
}
}