Ejemplo n.º 1
0
 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);
     }
 }
Ejemplo n.º 2
0
        /// <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();
        }
Ejemplo n.º 3
0
        //关闭显示页面
        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();
        }
Ejemplo n.º 4
0
        /// <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();
                }
            }
        }
Ejemplo n.º 5
0
 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;
 }
Ejemplo n.º 6
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();
                //}
            }
        }
Ejemplo n.º 7
0
 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"); }
 }
Ejemplo n.º 8
0
        /// <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();
        }
Ejemplo n.º 9
0
 //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
     {
     }
 }
Ejemplo n.º 10
0
        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);//不存在
        }
Ejemplo n.º 11
0
 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);
 }