WinFrom 窗体内嵌子窗体
需要展示的效果如下
Form1代码如下:
using System; using System.Windows.Forms; namespace Winfrom技巧 { public partial class Form1 : Form { public Form1() { InitializeComponent(); this.IsMdiContainer = true; } private void 窗体2ToolStripMenuItem_Click(object sender, EventArgs e) { Form2 frm2 = new Form2(); frm2.MdiParent = this; frm2.Show(); } private void 窗体3ToolStripMenuItem_Click(object sender, EventArgs e) { Form3 frm3 = new Form3(); frm3.MdiParent = this; frm3.Show(); } } }