日期:2014-05-17 浏览次数:20821 次
Form2 f2 = new Form2(); f2.Show(); this.Hide();
------解决方案--------------------
主窗体: public partial class FrmMain : Form { public FrmMain() { InitializeComponent(); this.Text = this.Handle.ToString(); } private void button1_Click(object sender, EventArgs e) { this.Visible = false; Form1 frm = new Form1(this); frm.Show(); } } Form1: public partial class Form1 : Form { private FrmMain _FrmMain; public Form1(FrmMain frmMain) { InitializeComponent(); _FrmMain =frmMain; } private void button1_Click(object sender, EventArgs e) { Close(); _FrmMain.Visible=true; } }
------解决方案--------------------
主窗体:
private void button1_Click(object sender, EventArgs e) { Form2 f2 = new Form2(); f2.parentForm = this; f2.Show(); this.Hide(); }