private void AddTab(string text, string typeName, bool ShowQuestionClose) { var control = (ReportChekhayePardakhti)GetObjectFromString(typeName); control.Dock = DockStyle.Fill; control.label1.Text = "لود كردن usercontrol مربوط به " + text; //Label lbl = new Label() //{ // Text = name, // Dock = DockStyle.Bottom //}; Atiran.Utility.Docking2.Desk.DeskTab sh = new Atiran.Utility.Docking2.Desk.DeskTab(); sh.Text = text; sh.Controls.Add(control); sh.ShowQuestionClose = ShowQuestionClose; sh.Show(MainTab); //MainTab.TabPages.Add(name, text); //int intextTab = MainTab.TabPages.Count - 1; //MainTab.SelectTab(intextTab); //var tabpage = MainTab.TabPages[intextTab]; //tabpage.BackColor = Color.White; //tabpage.Controls.Add(control); }
private void TryClose(Atiran.Utility.Docking2.Desk.DeskTab form, System.Windows.Forms.Form[] forms) { if (form.ShowQuestionClose) { if (!isCLoseAll) { string TextTabs = form.Text; foreach (System.Windows.Forms.Form tab in forms) { TextTabs += "\n" + tab.Text; } var result = ShowPersianMessageBox.ShowMessge("آيا تب ها بسته شوند؟", TextTabs, MessageBoxButtons.YesNo, false); if (result == DialogResult.Yes) { form.Close(); } else if (result == DialogResult.OK) { isCLoseAll = true; form.Close(); } else if (result == DialogResult.Cancel) { isCanselCLoseAll = true; } } else { form.Close(); } } else { form.Close(); } deskTabs.Remove(form); }