Beispiel #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);
            }
Beispiel #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);
            }
        }
Beispiel #3
0
 protected virtual TabStripItem CreateTabItem(TabPanel tabPanel)
 {
     return(new TabStripItem(tabPanel));
 }
 public void Insert(int index, TabPanel tabPanel)
 {
     this.owner.Controls.Add((Control)tabPanel);
     this.owner.Controls.SetChildIndex((Control)tabPanel, index);
     this.owner.SelectedIndex = index;
 }
Beispiel #5
0
 public TabStripPanelEventArgs(TabPanel tabPanel, int tabPanelIndex, TabControlAction action)
 {
     this.tabPanel      = tabPanel;
     this.tabPanelIndex = tabPanelIndex;
     this.action        = action;
 }
Beispiel #6
0
 public TabStripPanelSelectedIndexChangingEventArgs(int oldIndex, int newIndex, TabPanel oldTabPanel, TabPanel newTabPanel)
 {
     this.oldIndex    = oldIndex;
     this.newIndex    = newIndex;
     this.oldTabPanel = oldTabPanel;
     this.newTabPanel = newTabPanel;
 }
Beispiel #7
0
 public void Free()
 {
     tabPanel = null;
 }