示例#1
0
            public override void Remove(Control value)
            {
                int index = this.IndexOf(value);

                if (index == -1)
                {
                    return;
                }

                this.owner.SuspendStripNotifications(true, true);

                TabPanel panel         = (TabPanel)value;
                int      selectedIndex = this.owner.SelectedIndex;

                base.Remove(value);
                this.owner.RemoveTabElement((TabPanel)value);

                if (this.owner.IsHandleCreated)
                {
                    if (this.Count > 0)
                    {
                        if (index > this.Count - 1)
                        {
                            index = this.Count - 1;
                        }
                        this.owner.selectedIndex = index;
                    }
                    else
                    {
                        this.owner.selectedIndex = -1;
                    }
                    this.owner.UpdateTabSelection(true);
                }

                this.owner.ResumeStripNotifications(true, true);
                this.owner.UpdateAfterControlRemoved(value);
            }
示例#2
0
        private void SetSelected(TabPanel tabPanel)
        {
            tabPanel.SuspendLayout();

            bool selectionChange = !tabPanel.Visible;
            bool focused         = this.ContainsFocus;

            tabPanel.Visible = true;
            if (selectionChange && focused)
            {
                tabPanel.Focus();
            }

            tabPanel.Bounds = this.TabPanelBounds;
            SelectTabItem(tabPanel.TabStripItem);

            tabPanel.ResumeLayout();

            if (!this.DesignMode || !selectionChange)
            {
                return;
            }

            ISelectionService selService = this.GetService(typeof(ISelectionService)) as ISelectionService;

            if (selService != null)
            {
                selService.SetSelectedComponents(new Component[] { tabPanel }, SelectionTypes.Replace);
            }
            IComponentChangeService changeService = this.GetService(typeof(IComponentChangeService)) as IComponentChangeService;

            if (changeService != null)
            {
                changeService.OnComponentChanged(this, null, null, null);
            }
        }
示例#3
0
 protected virtual TabStripItem CreateTabItem(TabPanel tabPanel)
 {
     return(new TabStripItem(tabPanel));
 }
示例#4
0
 public void Insert(int index, TabPanel tabPanel)
 {
     this.owner.Controls.Add((Control)tabPanel);
     this.owner.Controls.SetChildIndex((Control)tabPanel, index);
     this.owner.SelectedIndex = index;
 }
示例#5
0
 public TabStripPanelEventArgs(TabPanel tabPanel, int tabPanelIndex, TabControlAction action)
 {
     this.tabPanel      = tabPanel;
     this.tabPanelIndex = tabPanelIndex;
     this.action        = action;
 }
示例#6
0
 public TabStripPanelSelectedIndexChangingEventArgs(int oldIndex, int newIndex, TabPanel oldTabPanel, TabPanel newTabPanel)
 {
     this.oldIndex    = oldIndex;
     this.newIndex    = newIndex;
     this.oldTabPanel = oldTabPanel;
     this.newTabPanel = newTabPanel;
 }
示例#7
0
 public void Free()
 {
     tabPanel = null;
 }