private void 门诊划价ToolStripMenuItem1_Click(object sender, EventArgs e) { mzhj mzhj = new mzhj(); //mzhj为窗体Form mzhj.MdiParent = this; TabPage tb = new TabPage(); tb.Controls.Add(mzhj); //将窗体添加到form中 tb.Text = mzhj.Text + " "; //设定tabpage标签 tb.Name = mzhj.Name; //设定tabpage的name属性,为了之后的新增和销毁处理 this.deltabControl1.TabPages.Add(tb); mzhj.FormBorderStyle = FormBorderStyle.None; //去除原form自带的边框 mzhj.Dock = DockStyle.Fill; //填充整个tabpage mzhj.Show(); deltabControl1.SelectedTab = deltabControl1.TabPages[deltabControl1.TabPages.Count - 1];
结合TabControl带删除键实现如下效果 (winform设置TabControl带删除键 - 帅气型男 - 博客园 (cnblogs.com)),也可设置事件双击关闭等等