C#窗体跳转和隐藏原来的窗体
程序员文章站
2022-06-10 11:10:25
...
C#窗体如何从Form1跳转到Form2,同时隐藏Form1,关闭Form2时显示Form1
Form1,Form2的代码如下
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
this.Visible = false;
Form2 f = new Form2(this);
f.Visible = true;
}
}
public partial class Form2 : Form
{
public static Form2 frm2;
private Form1 returnForm1 = null;
public Form2(Form1 F1)
{
InitializeComponent();
this.returnForm1 = F1;
frm2 = this;
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
this.returnForm1.Visible = true;
}
}
上一篇: php不写闭合标签的好处_php技巧
下一篇: PHP中strtr字符串替换用法详解