/// <summary> /// タブを閉じる。 /// </summary> /// <returns></returns> public bool CloseTabPage() { if (!this.CanRedock) { return(true); } for (int i = this.ChildTabPages.Count - 1; i >= 0; i--) { DockingTabPage item = this.ChildTabPages[i]; if (!item.CloseTabPage()) { return(false); } } this.ChildTabPages.Clear(); DockingTab tab = this.Parent as DockingTab; if (tab != null) { tab.SelectedTabControl = this; } this.IsClosing = true; bool result = CloseFormsInTabPage(); this.IsClosing = false; return(result); }
/// <summary> /// タブを閉じる。 /// </summary> /// <param name="cancelTabPage">キャンセルするタブ</param> /// <returns></returns> public bool CloseTabPage(DockingTabPage cancelTabPage) { for (int i = this.TabPages.Count - 1; i >= 0; i--) { DockingTabPage item = this.TabPages[i]; if (cancelTabPage != null) { //キャンセル対象ならスキップ if (object.ReferenceEquals(item, cancelTabPage)) { continue; } //子にキャンセル対象があればスキップ else if (item.ContainsChildren(cancelTabPage)) { continue; } } if (!item.CloseTabPage()) { return(false); } } if (cancelTabPage != null) { this.SelectedTabControl = cancelTabPage; } return(true); }
private void popMenuClose_Click(object sender, EventArgs e) { if (null != dtpWantClose && dtpWantClose.CanRedock) { if (dtpWantClose.CloseTabPage()) { if (0 == dockingTab.TabPages.Count) { this.Close(); } } } }