关于窗体切换显示的东东- 边学习边实践- 51CTO技术博客

//点击form1上button1隐藏form1,显示form2

             private void button1_Click(object sender, EventArgs e)
             {
                     this.Hide();
                     Form2 fm2=new Form2(0;
                     fm2.Show();
             }
//关闭fomr2,显示form1

             private void showfm1(object sender, FormClosingEventArgs e)
             {
                     Form1 fm1 = new Form1();
                     fm1.Show();
             }
//form1 code

             private void button1_Click(object sender, EventArgs e)
             {
                     this.Hide();
                     Form frm = new Form2(this);
                     frm.Show();
             }
//form2 code
             private Form m_frm;
             public Form2(Form frm)
             {
                     InitializeComponent();
                     m_frm = frm;
             }

             private void showfm1(object sender, FormClosingEventArgs e)
             {
                     if (m_frm != null)
                     {
                             m_frm.Show();
                     }
             }
                private void button1_Click(object sender, EventArgs e)
                {
                        this.Hide();
                        Form frm = new Form2(this);
                        //定义新窗体使用当前窗体的坐标
                        frm.SetDesktopLocation(this.DesktopLocation.X,this.DesktopLocation.Y);
                        frm.Show();
                }

本文出自 “” 博客,请务必保留此出处





郑重声明:资讯 【关于窗体切换显示的东东- 边学习边实践- 51CTO技术博客】由 发布,版权归原作者及其所在单位,其原创性以及文中陈述文字和内容未经(企业库qiyeku.com)证实,请读者仅作参考,并请自行核实相关内容。若本文有侵犯到您的版权, 请你提供相关证明及申请并与我们联系(qiyeku # qq.com)或【在线投诉】,我们审核后将会尽快处理。
—— 相关资讯 ——