private void barButtonItem2_ItemClick(object sender, ItemClickEventArgs e) { try { MessageBoxButtons messButton = MessageBoxButtons.OKCancel; DialogResult dr = MessageBox.Show("您确定要注销吗?", "注销用户", messButton); if (dr == DialogResult.OK) { // 重置全局变量 // 重置按钮 // 重置树 // 关闭除主页外的全部标签页 for (int i = xtraTabControl1.TabPages.Count - 1; i > 0; i--) { XtraTabPage page = xtraTabControl1.TabPages[i]; if (page.Text != "首 页") { xtraTabControl1.TabPages.Remove(page); page.Dispose(); } } } } catch (Exception ex) { MessageBox.Show("Log写入失败:" + ex.Message); } }
/// <summary> /// 关闭标签页 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void xtraTabControl1_CloseButtonClick(object sender, EventArgs e) { ClosePageButtonEventArgs arg = e as ClosePageButtonEventArgs; XtraTabPage curPage = (XtraTabPage)arg.Page; ///////// 清除页面追踪 //////// openedTabPage.Remove(curPage.Tag.ToString()); curPage.Dispose(); }
//关闭显示页面 private void xtraTabControl2_CloseButtonClick(object sender, EventArgs e) { if (this.xtraTabControl2.SelectedTabPageIndex == 0) { return; //如果是关闭主页,则返回 } XtraTabPage tabPage = this.xtraTabControl2.SelectedTabPage; this.xtraTabControl2.SelectedTabPageIndex -= 1; this.xtraTabControl2.TabPages.Remove(tabPage); tabPage.Dispose(); GC.Collect(); }
/// <summary> /// 关闭按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void xtraTabControl1_CloseButtonClick(object sender, EventArgs e) { PageEventArgs ea = e as PageEventArgs; if (ea != null) { XtraTabPage page = ea.Page as XtraTabPage; if (page != null) { page.Dispose(); } } }
public void ScreeningDeleted(Worksheet model) { if (xtraTabControl.SelectedTabPage.IsNotNull()) { XtraTabPage tp = xtraTabControl.SelectedTabPage; ScreeningCtrl control = tp.Controls[0].CastToType <ScreeningCtrl>(); if (control.IsNotNull()) { control.Remove(); xtraTabControl.TabPages.Remove(tp); tp.Dispose(); } } btnDeleteScreening.Enabled = model.Screenings.Count() > 0; }
private void tbcPages_CloseButtonClick(object sender, EventArgs e) { if (!_isMouseRightClick) { //XtraTabControl tcl = sender as XtraTabControl; //XtraTabHitInfo thi = tcl.CalcHitInfo(MousePosition); XtraTabPage tpg = ((ClosePageButtonEventArgs)e).Page as XtraTabPage; tpg.Controls[0].Dispose(); tpg.Dispose(); //if (tbcPages.SelectedTabPage == null) //{ // toolStrip1.Items.Clear(); //} } }
private void XtraTabControl1_CloseButtonClick(object sender, EventArgs e) { try { XtraTabPage xtra = (XtraTabPage)(e as DevExpress.XtraTab.ViewInfo.ClosePageButtonEventArgs).Page; if (xtra.Name != "pageMain") { xtraTabControl1.TabPages.Remove(xtra); xtraTabControl1.SelectedTabPageIndex = xtraTabControl1.TabPages.Count - 1; foreach (Control ctl in xtra.Controls) { ctl.Dispose(); } xtra.Dispose(); } } catch { XtraMessageBox.Show("Có lỗi xảy ra"); } }
/// <summary> /// 탭 페이지 삭제 이벤트 /// </summary> private void xtraTabControl1_CloseButtonClick(object sender, EventArgs e) { // Config 탭은 삭제하지 않음 if (xtraTabControl1.SelectedTabPage == xtpConfig) { return; } DevExpress.XtraTab.ViewInfo.ClosePageButtonEventArgs arg = e as DevExpress.XtraTab.ViewInfo.ClosePageButtonEventArgs; XtraTabPage xtraTabPage = arg.PrevPage as XtraTabPage; if (xtraTabPage == null) { return; } xtraTabControl1.TabPages.Remove(xtraTabPage); xtraTabPage.Dispose(); }
//TabPage关闭 private void xtraTabControl_Main_CloseButtonClick(object sender, EventArgs e) { try { if (this.xtraTabControl_Main.SelectedTabPage.Text == this.xtraTabPage_Home.Text) { return; //如果是关闭主页,则返回 } XtraTabPage tabPage = this.xtraTabControl_Main.SelectedTabPage; //int tabIndex = this.xtraTabControl_Main.SelectedTabPageIndex; this.xtraTabControl_Main.SelectedTabPageIndex -= 1; this.xtraTabControl_Main.TabPages.Remove(tabPage); tabPage.Dispose(); GC.Collect(); } catch { } }
private Boolean IsExisted(string MainTabControlKey, XtraTabControl objTabControl) { //遍历选项卡判断是否存在该子窗体 foreach (Control con in objTabControl.Controls) { XtraTabPage tab = (XtraTabPage)con; if (tab.Name == MainTabControlKey) { return(true);//存在 } else { bool flag = false; foreach (NavBarItemLink menuLink in menuGroup.ItemLinks) { if (MainTabControlKey.Equals(menuLink.ItemName)) { flag = true; } } if (flag) { //判断 操作菜单下的项是否已经打开。有,则关闭并取代;无,则显示 foreach (NavBarItemLink menuLink in menuGroup.ItemLinks) { if (tab.Name.Equals(menuLink.ItemName))//说明已经打开过操作菜单 { foreach (Control frm in tab.Controls) { Form f = (Form)frm; f.Close(); } tab.Dispose(); } } } } } return(false);//不存在 }
public void ProbeChenged(List <Screening> Screenings) { this.xtraTabControl.SelectedPageChanged -= new DevExpress.XtraTab.TabPageChangedEventHandler(this.xtraTabControl_SelectedPageChanged); for (int i = xtraTabControl.TabPages.Count - 1; i >= 0; i--) { XtraTabPage tp = xtraTabControl.TabPages[i]; ScreeningCtrl control = tp.Controls[0].CastToType <ScreeningCtrl>(); if (control.IsNotNull()) { control.Remove(); xtraTabControl.TabPages.Remove(tp); tp.Dispose(); } } btnDeleteScreening.Enabled = false; foreach (Screening screening in Screenings) { ScreeningAdded(screening); } InvokeScreeningChanged(); this.xtraTabControl.SelectedPageChanged += new DevExpress.XtraTab.TabPageChangedEventHandler(this.xtraTabControl_SelectedPageChanged); }