日期:2014-05-20 浏览次数:20916 次
public partial class MainForm : Form { public Form formA=new Form();Form formB=new Form(); } public partial class FormA:Form{ public void Load(){ MainForm1.formB.Show(); } }
------解决方案--------------------
原来是3个
主窗体跳转A窗体: private void button1_Click(object sender, EventArgs e)
{
FormA frmA = new FormA(this);
frmA.Show();
this.Hide();
}
A窗体跳转到B窗体:
private void button1_Click(object sender, EventArgs e)
{
FormB frmB = new FormB();
frmB.Owner = this.Owner
frmB.Show();
this.Hide();
}
B窗体跳转到主窗体:
private void FormB_MouseDoubleClick(object sender, MouseEventArgs e)
{
if(this.Owner != null)
this.Owner.Show();
else
{
FrmMain frmMain = new FrmMain();
frmMain.Show();
this.Hide();
}
}