[C#]WinForm父子視窗簡易操作(Hide,Show)

之前有人問到這個問題...小弟找到一個不錯的方法...分享給大家呀...

之前有人問到這個問題...小弟找到一個不錯的方法...分享給大家呀...

winform(C#)

        private void button1_Click(object sender, EventArgs e)
        {
            Form2 frm2 = new Form2();
            frm2.FormClosed += new FormClosedEventHandler(frm2_FormClosed);
            frm2.Show();//開啟子視窗
            this.Hide();//隱藏父視窗
        }


        void frm2_FormClosed(object sender, FormClosedEventArgs e)
        {
            this.Show();//子視窗關閉時,父視窗再顯示出來
        }

參考網址:

http://www.dotnetcurry.com/ShowArticle.aspx?ID=125&AspxAutoDetectCookieSupport=1
http://www.blueshop.com.tw/board/show.asp?subcde=BRD2008070818424355K&fumcde=FUM20050124192253INM