MDI窗体应用程序

来源:互联网 发布:软件检测工程师 编辑:程序博客网 时间:2024/06/06 02:31
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;namespace MDI窗体应用程序1{    public partial class Form1 : Form    {        public Form1()        {            InitializeComponent();            mdiChildForm1 = new Form2();            mdiChildForm2 = new Form3();            mdiChildForm1.MdiParent = this;            mdiChildForm2.MdiParent = this;        }        private Form2 mdiChildForm1;        private Form3 mdiChildForm2;        private void Form1_Activated(object sender, EventArgs e)        {            foreach (Form mdiChildForm in this.MdiChildren)                mdiChildForm.Show();        }    }}

记住需要设置Form1的IsMdiContainer属性为True
原创粉丝点击