Example #1
0
        private int GetIndex(VisualTabPage p)
        {
            int index = 0;

            foreach (VisualTabPage p_ in Tabs)
            {
                if (p_ == p)
                {
                    return(index);
                }
                else
                {
                    index++;
                }
            }
            return(-1);
        }
Example #2
0
        public void CloseTab(VisualTabPage page)
        {
            if (this._Tabs.Contains(page))
            {
                page.Hide();
                this.Controls.Remove(page);
                this._Tabs.Remove(page);

                _SelectedTab = 0;

                RefreshTab();
                if (page != NoTabsAdded)
                {
                    ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(OnTabRemoved), page);
                }
            }
        }
Example #3
0
        public VisualTabControl()
        {
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.ResizeRedraw, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);

            this.Padding = Tab_Renderer.Margins;

            NoTabsAdded = new VisualTabPage();
            NoTabsAdded.Text = "(Empty)";

            Label l = new Label();
            l.Text = "No tabs are added to this control!";
            l.Dock = DockStyle.Fill;
            NoTabsAdded.Padding = new System.Windows.Forms.Padding(5, 5, 5, 5);
            NoTabsAdded.Controls.Add(l);

            this.SelectedTabIndex = 0;
        }
Example #4
0
        public VisualTabControl()
        {
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.ResizeRedraw, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);

            this.Padding = Tab_Renderer.Margins;

            NoTabsAdded      = new VisualTabPage();
            NoTabsAdded.Text = "(Empty)";

            Label l = new Label();

            l.Text = "No tabs are added to this control!";
            l.Dock = DockStyle.Fill;
            NoTabsAdded.Padding = new System.Windows.Forms.Padding(5, 5, 5, 5);
            NoTabsAdded.Controls.Add(l);

            this.SelectedTabIndex = 0;
        }
Example #5
0
 private int GetIndex(VisualTabPage p)
 {
     int index = 0;
     foreach (VisualTabPage p_ in Tabs)
     {
         if (p_ == p)
             return index;
         else
             index++;
     }
     return -1;
 }
Example #6
0
 public bool IsSelected(VisualTabPage p)
 {
     return ((GetIndex(p) == this._SelectedTab) ? true : false);
 }
Example #7
0
        public void CloseTab(VisualTabPage page)
        {
            if (this._Tabs.Contains(page))
            {
                page.Hide();
                this.Controls.Remove(page);
                this._Tabs.Remove(page);

                _SelectedTab = 0;

                RefreshTab();
                if (page != NoTabsAdded)
                {
                    ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(OnTabRemoved), page);
                }
            }
        }
Example #8
0
 public void AddTab(VisualTabPage p)
 {
     AddTab(p, false);
 }
Example #9
0
        public void AddTab(VisualTabPage p, bool switchto)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new VisualTabPage_AddTab(AddTab), new object[2] { p, switchto });
                return;
            }
            if (p.Master != null && p.Master != this)
                throw new Exception("Please give a tab only 1 master control!");
            p.Master = this;
            p.Hide();
            this.Tabs.Add(p);
            this.Controls.Add(p);

            if (this.Tabs.Contains(NoTabsAdded) && NoTabsAdded != p)
            {
                this.Tabs.Remove(NoTabsAdded);
                this.Controls.Remove(NoTabsAdded);
                switchto = true;
            }
            if (switchto)
                _SelectedTab = Tabs.Count - 1;
            Repaint();

            if (p != NoTabsAdded)
            {
                ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(OnTabAdded), p);
            }
        }
Example #10
0
 public bool IsSelected(VisualTabPage p)
 {
     return((GetIndex(p) == this._SelectedTab) ? true : false);
 }
Example #11
0
 public void AddTab(VisualTabPage p)
 {
     AddTab(p, false);
 }