天天看点

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