public void AddPages(Form Dialog) { BackgroundImage = null; string DialogTitile = Dialog.Tag.ToString(); if (DropDownDialogMenu.Items.Find(DialogTitile, false).Length != 0) { DlgContainer.SelectTab(DialogTitile); return; } Dialog.TopLevel = false; Dialog.Dock = DockStyle.Fill; TabPage tabPage = new TabPage(); tabPage.AutoScroll = true; tabPage.Name = DialogTitile; tabPage.Text = DialogTitile; Dialog.Show(); tabPage.Controls.Add(Dialog); DlgContainer.TabPages.Add(tabPage); ToolStripMenuItem item = new ToolStripMenuItem(); item.Click += StripMenuClick; item.Text = DialogTitile; item.Name = DialogTitile; item.Size = new Size(117, 24); DropDownDialogMenu.Items.Add(item); TabShow(); DlgContainer.SelectTab(DialogTitile); }
private void StripMenuClick(object sender, EventArgs e) { string currentDialog = ((ToolStripMenuItem)sender).Text; DlgContainer.SelectTab(currentDialog); }