点击菜单下面的某个子菜单,打开一个子窗体,tabcontrol自动增加一个页面,页面名称就是子窗体的名称,该如何实现?

解决方案 »

  1.   

    子窗体的名称可以在生成的时候 自己指定的  Form ff = new Form();
                ff.Text = "ff";
                ff.Show();
      

  2.   

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;namespace WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }        private void button1_Click(object sender, EventArgs e)
            {
                Form ff = new Form();
                ff.Text = "ff";
                ff.Show();
                           TabPage tab = new TabPage("ff"); //选项卡文本                this.tabControl1.TabPages.Add(tab);            tabControl1.SelectTab(Convert.ToInt16(tabControl1.TabPages.Count - 1)); 
            }
        }
    }
      

  3.   

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;namespace WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }        private void button1_Click(object sender, EventArgs e)
            {
                Form ff = new Form();
                ff.Text = "ff";
                ff.MdiParent=this;
                ff.Show();
               
             }
        }
    }