设置窗体为父窗体

实现效果:

  

知识运用:

  1,IsMdiContainer属性 //该值指示窗体是否为多文档界面(MDI)子窗体的容器

  2,MdiParent属性  //获取或设置此窗体的多文档界面文档(MDI)父窗体  属性值Form类型

实现代码:

        private void button1_Click(object sender, EventArgs e)
        {
            this.IsMdiContainer = true;
            Form2 fm2 = new Form2();
            fm2.MdiParent = this;
            fm2.Show();
        }

猜你喜欢

转载自www.cnblogs.com/feiyucha/p/10129156.html
今日推荐