public void ReDockTabPage(DockingTabPage tp) { if (tp.Parent is DockingTab) { DockingTab tabPanel = tp.Parent as DockingTab; //移動 tabPanel.RemoveTabPage(tp); Controls.Add(tp); SelectedTabControl = tp; } }
//*** Add 2009/07/09 End K.Misu //*** Add 2009/07/06 Sta K.Misu /// <summary> /// TabPageを閉じます。 /// </summary> protected bool CloseFormsInTabPage() { foreach (Control control in this.Controls) { Form formTemp = control as Form; if (null != formTemp) { bool bIsClosable = true; //this.IsCloseMessageShown = false; Type type = formTemp.GetType(); MethodInfo info = type.GetMethod("ProcessClose", BindingFlags.Instance | BindingFlags.NonPublic); if (null != info) { bIsClosable = (bool)info.Invoke(formTemp, null); } //ProcessCloseがTrueならBusinessFormのMainCloseが既に処理されているので //絶対にCloseしないといけない。 if (bIsClosable) { //this.IsCloseMessageShown = true; formTemp.Close(); //this.IsCloseMessageShown = false; } if (!bIsClosable) { return(false); } } } if (this.Parent is DockingTab) { DockingTab dtpParent = this.Parent as DockingTab; dtpParent.SuspendLayout(); this.SuspendLayout(); dtpParent.RemoveTabPage(this); dtpParent.ResumeLayout(true); if (dtpParent.TabPages.Count > 0) { DockingTabPage selectTabPage = null; if (this.ParentTabPage != null && dtpParent.TabPages.Contains(this.ParentTabPage)) { selectTabPage = this.ParentTabPage; } else { selectTabPage = dtpParent.TabPages[dtpParent.TabPages.Count - 1]; } dtpParent.SelectedTabControl = selectTabPage; } if (this.ParentTabPage != null) { if (this.ParentTabPage.ChildTabPages.Contains(this)) { this.ParentTabPage.ChildTabPages.Remove(this); } this.ParentTabPage = null; } this.Dispose(); } return(true); }