public TabControlWithAdd(Form1 father) { this.father = father; this.MouseDown += TabControlWithAdd_MouseDown; DialogueTab tabPage1 = new DialogueTab("Scene1"); TabPage tabPage2 = new TabPage(); tabPage2.Location = new System.Drawing.Point(4, 22); tabPage2.Name = "tabPage2"; tabPage2.Padding = new System.Windows.Forms.Padding(3); tabPage2.Size = new System.Drawing.Size(787, 413); tabPage2.TabIndex = 1; tabPage2.Text = "+"; tabPage2.UseVisualStyleBackColor = true; Controls.Add(tabPage1); Controls.Add(tabPage2); Dock = System.Windows.Forms.DockStyle.Fill; Location = new System.Drawing.Point(3, 26); Name = "tabControl1"; SelectedIndex = 0; Size = new System.Drawing.Size(795, 439); }
//Add tab to tabcontrol public void createSceneTab(string scene) { TabPage tplus = tabControl1.TabPages[tabControl1.TabCount - 1]; tabControl1.TabPages.RemoveAt(tabControl1.TabCount - 1); DialogueTab tp = new DialogueTab(scene); tp.UpdateCharacters(charactersList); tp.UpdateImages(imagesList); tabControl1.TabPages.Add(tp); tabControl1.TabPages.Add(tplus); tabControl1.SelectTab(scene); }