Ejemplo n.º 1
0
        /// <summary>
        /// Undock the Specified Panel to a Floating Window
        /// </summary>
        /// <param name="p">The panel to remove and add to a Floating Window</param>
        public void UnDockPanel(Panel p)
        {
            if (p.Parent.GetType() == typeof(TabPage))
            {
                //remove the tab from the tabStrip
                TabPage tp = (TabPage)p.Parent;
                _tabControl.TabPages.Remove((TabPage)p.Parent);
                ((TabPage)p.Parent).Controls.Remove(p);

                if (_tabControl.TabPages.Count == 0)
                {
                    //hide the splitter bar along with the panel
                    if (this.Dock == DockStyle.Left)
                    {
                        FormMain.Instance.splitterLeft.Visible = false;
                    }
                    else
                    {
                        FormMain.Instance.splitterRight.Visible = false;
                    }

                    this.Visible = false;
                }

                FormFloat formFloat = new FormFloat(ref p, FormMain.Instance, tp.Text);
                formFloat.Show();
                formFloat.Left = Cursor.Position.X - (formFloat.Width / 2);
                formFloat.Top  = Cursor.Position.Y;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Undock the Specified Panel to a Floating Window
        /// </summary>
        /// <param name="p">The panel to remove and add to a Floating Window</param>
        internal void UnDockPanel(Panel p)
        {
            if (p.Parent.GetType() == typeof(TabPage))
            {
                //remove the tab from the tabStrip
                TabPage tp = (TabPage)p.Parent;
                _tabControl.TabPages.Remove((TabPage)p.Parent);
                ((TabPage)p.Parent).Controls.Remove(p);

                if (_tabControl.TabPages.Count == 0)
                {
                    //hide the splitter bar along with the panel
                    if (this.Dock == DockStyle.Left)
                        FormMain.Instance.splitterLeft.Visible = false;
                    else
                        FormMain.Instance.splitterRight.Visible = false;

                    this.Visible = false;
                }

                FormFloat formFloat = new FormFloat(ref p, FormMain.Instance, tp.Text);
                formFloat.Show();
                formFloat.Left = Cursor.Position.X - (formFloat.Width / 2);
                formFloat.Top = Cursor.Position.Y;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Undock the Specified Panel to a Floating Window
        /// </summary>
        /// <param name="p">The panel to remove and add to a Floating Window</param>
        internal void UnDockPanel(Panel p)
        {
            if (p.Parent.GetType() == typeof(TabPage))
            {
                //System.Diagnostics.Debug.WriteLine(panel1.Parent.Name);
                //remove the tab from the tabStrip
                TabControl t = (TabControl)p.Parent.Parent;
                TabPage tp = (TabPage)p.Parent;
                ((TabControl)p.Parent.Parent).TabPages.Remove((TabPage)p.Parent);
                ((TabPage)p.Parent).Controls.Remove(p);

                if (t.TabPages.Count == 0)
                {
                    //hide the splitter bar along with the panel
                    if (t.Parent == panelDockLeft)
                        splitterLeft.Visible = false;
                    else if (t.Parent == panelDockRight)
                        splitterRight.Visible = false;

                    t.Parent.Visible = false;
                }

                FormFloat formFloat = new FormFloat(ref p, this, tp.Text);
                formFloat.Show();
                if (Cursor.Position.X - (formFloat.Width / 2) > 0)
                    formFloat.Left = Cursor.Position.X - (formFloat.Width / 2);
                else
                    formFloat.Left = 0;

                formFloat.Top = Cursor.Position.Y;
            }
        }