日期:2014-05-19  浏览次数:21078 次

WindowForm中,请问如何转向另一个窗体
在WindowForm中,我在Form1中怎么点击按钮后,转到Form2中去啊,其中让Form2是最大化的,充满整个屏幕


谢谢

------解决方案--------------------
Form2 formx = new Form2();
formx.WindowState = FormWindowState.Maximized;
formx.Show();
------解决方案--------------------
首先把你Form1中的那个被单击的按扭的DialogResult值置为OK

if(form1.DialogResult == DialogResult.OK)
{
form1.Visiable = false;
Form2 form2 = new Form2();
form2.FormBorderStyle = FormBorderStyle.None;
form2.WindowState = FormWindowState.Maximized;
form2.ShowDialog();
if(form2.DialogResult == DialogResult.Cancel)
{
form1.Close();
}
}
------解决方案--------------------
Form2 formx = new Form2();
formx.FormBorderStyle = FormBorderStyle.None;
formx.WindowState = FormWindowState.Maximized;
formx.Show();

form1.Visible = false;
------解决方案--------------------
while(true)
{
if(form1.DialogResult == DialogResult.OK)
{
if(yourContidition)
{
form1.Visiable = false;
Form2 form2 = new Form2();
form2.FormBorderStyle = FormBorderStyle.None;
form2.WindowState = FormWindowState.Maximized;
form2.ShowDialog();
if(form2.DialogResult == DialogResult.Cancel)
{
form1.Close();
break;
}
}
else
{
form1.Visiable = true;
form1.showDialog();
}
}
}