/// <summary> /// Creates a new tab page for creating a new profile. /// Populate tab page with custom user control, NewProfileControl /// </summary> /// <param name="sender">Add New Profile Menu Strip Item</param> /// <param name="e">Click</param> private void addNewProfileToolStripMenuItem_Click(object sender, EventArgs e) { TabPage newTab = new TabPage("New Profile"); NewProfileControl npc = new NewProfileControl(); newTab.Controls.Add(npc); npc.Location = new Point(0, 0); npc.Name = "newProfileControl"; npc.Size = new Size(456, 207); npc.TabIndex = 0; this.tabControl.TabPages.Add(newTab); this.tabControl.SelectedIndex = this.tabControl.TabPages.Count - 1; }
/// <summary> /// Used for comboBox dropdown tool strip item to create a new tab page for /// adding/modifying profiles /// </summary> /// <param name="sender">Tool Strip Item</param> /// <param name="e">Click</param> private void TSMIComboBox_Profiles_SelectedIndexChanged(object sender, EventArgs e) { if (TSMIComboBox_Profiles.SelectedIndex != 0) { Profile p = (Profile)TSMIComboBox_Profiles.SelectedItem; // Create new tab page with a new profile control TabPage newTab = new TabPage(p.Name); NewProfileControl npc = new NewProfileControl(p); newTab.Controls.Add(npc); npc.Location = new Point(0, 0); npc.Name = "newProfileControl"; npc.Size = new Size(456, 207); npc.TabIndex = 0; this.tabControl.TabPages.Add(newTab); this.tabControl.SelectedIndex = this.tabControl.TabPages.Count - 1; } }