Example #1
0
        public void ImportTabControl(TabControl tabControl)
        {
            this.SuspendLayout();
            tabControl.SuspendLayout();

            Pages.Clear();
            foreach (TabPage tabPage in tabControl.TabPages)
            {
                TabNavigatorPage page = new TabNavigatorPage();
                page.Text      = tabPage.Text;
                page.Visible   = false;
                page.Left      = 0;
                page.Top       = 0;
                page.Width     = tabPage.Width;
                page.Height    = tabPage.Height;
                page.Anchor    = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom;
                page.BackColor = Color.Transparent;
                Controls.Add(page);

                Pages.Add(page);

                /*
                 * List<Control> ctls = new List<Control>();
                 * foreach (Control c in tabPage.Controls)
                 * {
                 *  ctls.Add(c);
                 * }
                 * tabPage.Controls.Clear();
                 *
                 * foreach (Control c in ctls)
                 *  page.Controls.Add(c);
                 */

                for (; tabPage.Controls.Count > 0;)
                {
                    Control ctlChild = tabPage.Controls[0];

                    tabPage.Controls.Remove(ctlChild);
                    page.Controls.Add(ctlChild);
                }
            }
            //tabControl.Parent.Controls.Remove(this);
            tabControl.Visible = false;
            //this.Visible = false;

            ComputeSizes();

            SelectTab(0);

            this.ResumeLayout();
            tabControl.ResumeLayout();
        }
Example #2
0
        public void ImportTabControl(TabControl tabControl)
        {
            this.SuspendLayout();
            tabControl.SuspendLayout();

            Pages.Clear();
            foreach(TabPage tabPage in tabControl.TabPages)
            {
                TabNavigatorPage page = new TabNavigatorPage();
                page.Text = tabPage.Text;
                page.Visible = false;
                page.Left = 0;
                page.Top = 0;
                page.Width = tabPage.Width;
                page.Height = tabPage.Height;
                page.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom;
                page.BackColor = Color.Transparent;
                Controls.Add(page);

                Pages.Add(page);

                /*
                List<Control> ctls = new List<Control>();
                foreach (Control c in tabPage.Controls)
                {
                    ctls.Add(c);
                }
                tabPage.Controls.Clear();

                foreach (Control c in ctls)
                    page.Controls.Add(c);
                */

            for (;tabPage.Controls.Count > 0;)
                {
                    Control ctlChild = tabPage.Controls[0];

                    tabPage.Controls.Remove(ctlChild);
                    page.Controls.Add(ctlChild);
                }

            }
            //tabControl.Parent.Controls.Remove(this);
            tabControl.Visible = false;
            //this.Visible = false;

            ComputeSizes();

            SelectTab(0);

            this.ResumeLayout();
            tabControl.ResumeLayout();
        }