110,567
社区成员
发帖
与我相关
我的任务
分享
Form1代码:
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public Form2 frm { get; set; }
private void button1_Click(object sender, EventArgs e)
{
if (this.frm == null)
this.frm = new Form2();
this.frm.Show();
this.Hide();
}
}
}
Form2代码:
namespace WindowsFormsApplication1
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
public Form1 frm { get; set; }
private void button1_Click(object sender, EventArgs e)
{
if (this.frm == null)
this.frm = new Form1();
this.frm.Show();
this.Hide();
}
}
}