Exemplo n.º 1
0
        private void products_Click(object sender, EventArgs e)
        {
            if (!tabControl.TabPages.ContainsKey("p1"))
            {
                p1 = new ViewProduct(this.idioma);
                tabControl.Visible = true;
                p1.MdiParent       = this;
                p1.WindowState     = FormWindowState.Normal;
                p1.FormBorderStyle = FormBorderStyle.None;
                p1.TopLevel        = false;
                p1.Dock            = DockStyle.Fill;
                p1.Show();

                TabPage tp = new TabPage(products.Text);
                tp.Tag    = p1;
                tp.Name   = "p1";
                tp.Parent = tabControl;
                tabControl.SelectedTab = tp;
                p1.Tag = tp;
            }
            else
            {
                int n = tabControl.TabPages.IndexOfKey("p1");
                tabControl.SelectTab(n);
            }
        }