嗯,这样可以,窗体1:
public Form1()
{
InitializeComponent();
}
//窗体1的按钮事件
private void button1_Click(object sender, EventArgs e)
{
Form1 f = new Form1();
Form2 f2 = new Form2(f);
f2.Show();
this.Hide();
}
窗体2:
Form1 F1 = null;
public Form2(Form1 f)
{
F1 = f;
InitializeComponent();
}
//窗体2的关闭按钮事件
private void button1_Click(object sender, EventArgs e)
{
F1.Show();
this.Close();
}
试试吧,
将FORM1作为参数传入FORM2,比如显示form2时写成
form2.ower=this
form2.Show();
this.hide()
在点击按钮时:
this.ower.Show();
this.hide();
from1 btn click
{
this.Hide();
Form2 f2=new Form2();
f2.Show();
}
----------------------------------
Form1 _f1=null;
from2(Form1 f1)//构造
{
_f1=f1;
}
from2 btn Click
{
_f1.Show();
this.Close();
}