예제 #1
0
        /// <summary>
        ///   Handles the <see cref="TabPageCollection.TabPageRemoved" /> event of this
        ///   control's collection of <see cref="VerticalTabPages" />.
        /// </summary>
        /// <remarks>
        ///   This unwires the tab page from the control, and removes it to the <see cref="Controls" />
        ///   collection.
        /// </remarks>
        /// <param name="sender">The object that raised the event.</param>
        /// <param name="e">A <see cref="VerticalTabControl.TabPageEventArgs" /> describing the event arguments.</param>
        private void RemoveTabPage(object sender, TabPageEventArgs e)
        {
            var ctlPage = e.TabPage;

            ctlPage.TabButton.Selected -= TabSelected;
            foreach (var tabPage in TabPages)
            {
                if (tabPage.PageIndex > ctlPage.PageIndex)
                {
                    tabPage.PageIndex--;
                }
            }
            m_ptsTabContainer.removeToolStripItem(ctlPage.TabButton);
            if (SelectedTabPage == ctlPage)
            {
                if (TabPages.Count == 0)
                {
                    SelectedTabPage = null;
                }
                else if (SelectedIndex == TabPages.Count)
                {
                    SelectedIndex--;
                }
                else
                {
                    SelectedIndex++;
                }
            }
            Controls.Remove(e.TabPage);
        }
예제 #2
0
        /// <summary>
        ///   Handles the <see cref="TabPageCollection.TabPageRemoved" /> event of this
        ///   control's collection of <see cref="DropDownTabPages" />.
        /// </summary>
        /// <remarks>
        ///   This unwires the tab page from the control, and removes it to the <see cref="Controls" />
        ///   collection.
        /// </remarks>
        /// <param name="sender">The object that raised the event.</param>
        /// <param name="e">A <see cref="DropDownTabControl.TabPageEventArgs" /> describing the event arguments.</param>
        private void RemoveTabPage(object sender, TabPageEventArgs e)
        {
            var ctlPage = e.TabPage;

            ctlPage.PageIndexChanged -= PageIndexChanged;
            ctlPage.TextChanged      -= PageTextChanged;
            TabSelector.Items.Remove(ctlPage);
            foreach (var page in TabPages)
            {
                if (page.PageIndex > ctlPage.PageIndex)
                {
                    page.PageIndex--;
                }
            }
            if (SelectedTabPage == ctlPage)
            {
                if (TabPages.Count == 0)
                {
                    SelectedTabPage = null;
                }
                else if (SelectedIndex == TabPages.Count)
                {
                    SelectedIndex--;
                }
                else
                {
                    SelectedIndex++;
                }
            }
            Controls.Remove(e.TabPage);
        }
 private void xtraTabControl1_Selected(object sender, TabPageEventArgs e)
 {
     if (e.PageIndex == 0)
     {
         this.btLock.Enabled   = false;
         this.btOpen.Enabled   = false;
         this.btFinish.Enabled = false;
         if (this.lbNoSalaryTableList.Items.Count <= 0)
         {
             this.btNext.Enabled = false;
         }
         else
         {
             this.btNext.Enabled = true;
             this.btNext.Text    = "Tạo Dữ Liệu >";
         }
     }
     else if (this.lbSalaryTableList.Items.Count <= 0)
     {
         this.btNext.Enabled   = false;
         this.btLock.Enabled   = false;
         this.btOpen.Enabled   = false;
         this.btFinish.Enabled = false;
     }
     else
     {
         this.btNext.Enabled   = true;
         this.btLock.Enabled   = true;
         this.btOpen.Enabled   = true;
         this.btFinish.Enabled = true;
         this.btNext.Text      = "Xóa Dữ Liệu";
     }
 }
예제 #4
0
 private void xtraTabControl1_Selected(object sender, TabPageEventArgs e)
 {
     if (e.PageIndex != 0)
     {
         if (this.lbTimeKeeperShiftList.Items.Count <= 0)
         {
             this.btDelete.Enabled = false;
         }
         else
         {
             this.btDelete.Enabled = true;
         }
         this.btCreate.Enabled = false;
     }
     else
     {
         if (this.lbNoTimeKeeperShiftList.Items.Count <= 0)
         {
             this.btCreate.Enabled = false;
         }
         else
         {
             this.btCreate.Enabled = true;
         }
         this.btDelete.Enabled = false;
     }
 }
예제 #5
0
        private void tabControl_Viewer_TabePageClosing(object sender, TabPageEventArgs e)
        {
            SkinTabControl tb_doc = (SkinTabControl)sender;

            if (tb_doc.SelectedTab.Tag is DocViewer)
            {
                DocViewer uc_docviewer = (DocViewer)tb_doc.SelectedTab.Tag;
                uc_docviewer.doForDispose();
            }
        }
예제 #6
0
        private void FireTabPageRemoved(ITabPage tabPage, IBusinessObjectControl boControl)
        {
            if (this.TabPageRemoved == null)
            {
                return;
            }

            TabPageEventArgs eventArgs = new TabPageEventArgs(tabPage, boControl);

            this.TabPageRemoved(this, eventArgs);
        }
예제 #7
0
 private void tabControl_TabePageClosing(object sender, TabPageEventArgs e)
 {
     if (e.ColseTabPage.Text.Equals(GlobalData.Process))
     {
         DlgBox.Show("禁止关闭当前页面.", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         CancelEventArgs e1 = new CancelEventArgs();
         e1.Cancel = true;
         TabPag_Validating(e.ColseTabPage, e1);
         return;
     }
 }
예제 #8
0
        private void xtraTabControl1_Selected(object sender, TabPageEventArgs e)
        {
            switch (e.PageIndex)
            {
            case 0:
                this.richEditBarController1.RichEditControl = this.richEditControl1;
                break;

            case 1:
                this.richEditBarController1.RichEditControl = this.richEditControl2;
                break;
            }
        }
예제 #9
0
        private void tbcPages_Selected(object sender, TabPageEventArgs e)
        {
            //XtraTabPage tab = (XtraTabPage)tbcPages.SelectedTabPage;
            XtraTabControl control = (XtraTabControl)sender;
            XtraTabPage    tab     = control.SelectedTabPage;

            toolStrip1.Items.Clear();
            if (tab != null)
            {
                List <ToolStripItem> toollist = (List <ToolStripItem>)tab.Tag;

                toolStrip1.Items.AddRange(toollist.ToArray());
            }
        }
예제 #10
0
        /// <summary>
        ///   Handles the <see cref="TabPageCollection.TabPageAdded" /> event of this
        ///   control's collection of <see cref="VerticalTabPages" />.
        /// </summary>
        /// <remarks>
        ///   This wires the added tab page into the control, and adds it to the <see cref="Controls" />
        ///   collection.
        /// </remarks>
        /// <param name="sender">The object that raised the event.</param>
        /// <param name="e">A <see cref="VerticalTabControl.TabPageEventArgs" /> describing the event arguments.</param>
        private void AddTabPage(object sender, TabPageEventArgs e)
        {
            var ctlPage = e.TabPage;

            if (ctlPage.PageIndex == -1)
            {
                ctlPage.PageIndex = TabPages.Count - 1;
            }
            if (!TabPages.Contains(ctlPage))
            {
                TabPages.Add(ctlPage);
            }
            ctlPage.TabButton.Selected += TabSelected;
            m_ptsTabContainer.addToolStripItem(ctlPage.TabButton);
            ctlPage.Dock    = DockStyle.Fill;
            SelectedTabPage = ctlPage;
            Controls.Add(e.TabPage);
        }
예제 #11
0
        /// <summary>
        ///   Handles the <see cref="TabPageCollection.TabPageAdded" /> event of this
        ///   control's collection of <see cref="DropDownTabPages" />.
        /// </summary>
        /// <remarks>
        ///   This wires the added tab page into the control, and adds it to the <see cref="Controls" />
        ///   collection.
        /// </remarks>
        /// <param name="sender">The object that raised the event.</param>
        /// <param name="e">A <see cref="DropDownTabControl.TabPageEventArgs" /> describing the event arguments.</param>
        private void AddTabPage(object sender, TabPageEventArgs e)
        {
            var ctlPage = e.TabPage;

            if (ctlPage.PageIndex == -1)
            {
                ctlPage.PageIndex = TabPages.Count - 1;
            }
            if (!TabPages.Contains(ctlPage))
            {
                TabPages.Add(ctlPage);
            }
            ctlPage.PageIndexChanged += PageIndexChanged;
            ctlPage.TextChanged      += PageTextChanged;
            InsertTabPageInSelector(ctlPage);
            ctlPage.Dock = DockStyle.Fill;
            Controls.Add(e.TabPage);
            SelectedTabPage = ctlPage;
        }
예제 #12
0
        public void Test_WhenUsingCreator_WhenBusinessObejctRemovedToCollection_ShouldRemoveTab()
        {
            ITabControl            tabControl            = CreateTabControl();
            IControlFactory        controlFactory        = GetControlFactory();
            BOColTabControlManager selectorManager       = new BOColTabControlManager(tabControl, controlFactory);
            BusinessObjectControlCreatorDelegate creator = BusinessObjectControlCreator;

            selectorManager.BusinessObjectControlCreator = creator;

            MyBO removedBo = new MyBO();
            BusinessObjectCollection <MyBO> myBoCol = new BusinessObjectCollection <MyBO> {
                removedBo, new MyBO(), new MyBO()
            };

            selectorManager.BusinessObjectCollection = myBoCol;
            bool             pageRemovedEventFired = false;
            TabPageEventArgs ex = null;

            selectorManager.TabPageRemoved += (sender, e) =>
            {
                pageRemovedEventFired = true;
                ex = e;
            };
            ITabPage         tabPage = selectorManager.TabControl.TabPages[0];
            IControlHabanero boControlToBeRemoved = tabPage.Controls[0];

            //---------------Assert Precondition----------------
            Assert.AreEqual(3, selectorManager.TabControl.TabPages.Count);
            Assert.IsFalse(pageRemovedEventFired);
            //---------------Execute Test ----------------------
            selectorManager.BusinessObjectCollection.Remove(removedBo);
            //---------------Test Result -----------------------
            Assert.AreEqual(2, selectorManager.TabControl.TabPages.Count);

            Assert.AreEqual(removedBo.ToString(), tabPage.Text);
            Assert.AreEqual(removedBo.ToString(), tabPage.Name);
            Assert.AreEqual(1, tabPage.Controls.Count);

            Assert.IsTrue(pageRemovedEventFired);
            Assert.IsNotNull(ex);
            Assert.AreSame(tabPage, ex.TabPage);
            Assert.AreSame(boControlToBeRemoved, ex.BOControl);
        }
예제 #13
0
        public void Test_WhenUsingCreator_WhenBusinessObejctAddedToCollection_ShouldAddTab_CorrectName()
        {
            BusinessObjectControlCreatorDelegate creator;
            IBOColTabControl boColTabControl = CreateBOTabControlWithControlCreator(out creator);

            BusinessObjectCollection <MyBO> myBoCol = new BusinessObjectCollection <MyBO> {
                new MyBO(), new MyBO(), new MyBO()
            };

            boColTabControl.BusinessObjectCollection = myBoCol;
            bool             pageAddedEventFired = false;
            TabPageEventArgs ex = null;

            boColTabControl.TabPageAdded += (sender, e) =>
            {
                pageAddedEventFired = true;
                ex = e;
            };
            //---------------Assert Precondition----------------
            Assert.AreEqual(3, boColTabControl.TabControl.TabPages.Count);
            Assert.IsFalse(pageAddedEventFired);
            //---------------Execute Test ----------------------
            MyBO addedBo = new MyBO();

            boColTabControl.BusinessObjectCollection.Add(addedBo);
            addedBo.TestProp = TestUtil.GetRandomString();
            //---------------Test Result -----------------------
            Assert.AreEqual(4, boColTabControl.TabControl.TabPages.Count);
            ITabPage tabPage = boColTabControl.TabControl.TabPages[3];

            Assert.AreEqual(addedBo.ToString(), tabPage.Text);
            Assert.AreEqual(addedBo.ToString(), tabPage.Name);
            Assert.AreEqual(1, tabPage.Controls.Count);
            IControlHabanero boControl = tabPage.Controls[0];

            Assert.IsTrue(pageAddedEventFired);
            Assert.IsNotNull(ex);
            Assert.AreSame(tabPage, ex.TabPage);
            Assert.AreSame(boControl, ex.BOControl);
        }
예제 #14
0
 private void tabControl_TabePageClosed(object sender, TabPageEventArgs e)
 {
 }
예제 #15
0
 private void XtraTabControl1_Selected(object sender, TabPageEventArgs e)
 {
 }
예제 #16
0
 private void tabControl_Viewer_TabePageClosed(object sender, TabPageEventArgs e)
 {
     this.splitContainer1.Panel1Collapsed = false;
 }
예제 #17
0
 private void xtraTabControl1_Selected(object sender, TabPageEventArgs e)
 {
     if (e.PageIndex == 1)
     {
         gridView2.Columns["TotCprice1"].VisibleIndex = 5;
     }
 }
예제 #18
0
 private void xtraTabControl1_Selected(object sender, TabPageEventArgs e)
 {
     if (e.Page == this.tabAllowance)
     {
         if (this.xucSalaryAllowanceByEmployee == null)
         {
             this.xucSalaryAllowanceByEmployee = new xucSalaryAllowanceByEmployee(this.m_SalaryTableListID, this.m_EmployeeCode)
             {
                 Dock = DockStyle.Fill
             };
             this.tabAllowance.Controls.Add(this.xucSalaryAllowanceByEmployee);
         }
     }
     else if (e.Page == this.tabAdvance)
     {
         if (this.xucAdvance == null)
         {
             this.xucAdvance = new xucAdvance1(this.m_EmployeeCode, this.m_Month, this.m_Year)
             {
                 Dock = DockStyle.Fill
             };
             this.tabAdvance.Controls.Add(this.xucAdvance);
         }
     }
     else if (e.Page == this.tabSalaryPay)
     {
         if (this.xucSalaryPayByEmployee == null)
         {
             this.xucSalaryPayByEmployee = new xucSalaryPayByEmployee(this.m_SalaryTableListID, this.m_EmployeeCode)
             {
                 Dock = DockStyle.Fill
             };
             this.tabSalaryPay.Controls.Add(this.xucSalaryPayByEmployee);
         }
     }
     else if (e.Page == this.tabSalaryDebit)
     {
         if (this.xucSalaryDebitByEmployee == null)
         {
             this.xucSalaryDebitByEmployee = new xucSalaryDebitByEmployee(this.m_SalaryTableListID, this.m_EmployeeCode)
             {
                 Dock = DockStyle.Fill
             };
             this.tabSalaryDebit.Controls.Add(this.xucSalaryDebitByEmployee);
         }
     }
     else if (e.Page == this.tabAssignment)
     {
         if (this.xucAssignment == null)
         {
             this.xucAssignment = new xucAssignment1(this.m_EmployeeCode, this.m_Month, this.m_Year)
             {
                 Dock = DockStyle.Fill
             };
             this.tabAssignment.Controls.Add(this.xucAssignment);
         }
     }
     else if (e.Page == this.tabSalaryPlus)
     {
         if (this.xucSalaryPlus == null)
         {
             this.xucSalaryPlus = new xucSalaryPlusByEmployee(this.m_SalaryTableListID, this.m_EmployeeCode)
             {
                 Dock = DockStyle.Fill
             };
             this.tabSalaryPlus.Controls.Add(this.xucSalaryPlus);
         }
     }
     else if (e.Page == this.tabSalaryMinus)
     {
         if (this.xucSalaryMinus == null)
         {
             this.xucSalaryMinus = new xucSalaryMinusByEmployee(this.m_SalaryTableListID, this.m_EmployeeCode)
             {
                 Dock = DockStyle.Fill
             };
             this.tabSalaryMinus.Controls.Add(this.xucSalaryMinus);
         }
     }
 }