private void button1_Click(object sender, EventArgs e)
        {
            this.Text = "父表單";
            //設定為MDI Form(父表單)
            this.IsMdiContainer = true;
           
            Form2 f = new Form2();
        
            CreateChildForm(f);
        }
        private void CreateChildForm(Form f)
        {
            f.Text = "子表單";
            //設定為MDI Form(子表單)
            f.MdiParent = this;
            //最大化
            f.WindowState = FormWindowState.Maximized;
            //顯示子表單
            f.Show();
        }
執行畫面如下:

沒有留言:
張貼留言