设置MDI窗体,设置MDI背景

来源:互联网 发布:图书馆万方数据库入口 编辑:程序博客网 时间:2024/06/09 22:01

1、设置父窗体的IsMdiContainer = true;

2、代码:

            frmtest childForm = new frmtest();            childForm.MdiParent = this;            childForm.WindowState = FormWindowState.Maximized;            childForm.ControlBox = false;    //取消子窗体的最大化,最小化和还原按钮            childForm.Show();  

3、设置MDI背景:

        /// <summary>        /// 设置MDI背景        /// </summary>        void RemoveMdiBackColor()        {            foreach (Control c in this.Controls)            {                if (c is MdiClient)                {                    c.BackColor = System.Drawing.Color.Aqua;     //颜色                     c.BackgroundImage = this.BackgroundImage;                     this.IsMdiContainer//背景                 }            }        }