天天看點

WinForm 子窗體在父窗體範圍内移動,不能出父窗體 摘自于網絡

詳細解釋:1, 主窗體Form1屬性IsMdiContainer設為True,并添加ToolStrip控件, Toolstrip中添加一個按鈕toolStripButton1。 

        2,添加新窗體Form2。 

          3,主窗體Form1中toolStripButton1的Click事件 

          private void toolStripButton1_Click(object sender, EventArgs e) 

        { 

            Form2 f2 = new Form2(); 

            f2.MdiParent = this; 

            f2.Show(); 

        } 

最後看效果吧!

轉載于:https://www.cnblogs.com/qiushuixizhao/p/3877347.html