コード例 #1
0
        private DockAreaStyle GetDockAreaStyle(Control ctr, ref DockStyle eDockStyle)//递归 查询获取终级停靠区
        {
            if (ctr.Parent == null)
            {
                return(DockAreaStyle.eNone);
            }
            IDockArea pDockArea = null;

            if (ctr.Parent is System.Windows.Forms.SplitterPanel)
            {
                pDockArea = ctr.Parent.Parent as IDockArea;
                if (pDockArea != null)
                {
                    eDockStyle = pDockArea.Dock; return(pDockArea.eDockAreaStyle);
                }
                else
                {
                    return(GetDockAreaStyle(ctr.Parent.Parent, ref eDockStyle));
                }
            }
            else
            {
                pDockArea = ctr.Parent as IDockArea;
                if (pDockArea != null)
                {
                    eDockStyle = pDockArea.Dock; return(pDockArea.eDockAreaStyle);
                }
                else
                {
                    return(GetDockAreaStyle(ctr.Parent, ref eDockStyle));
                }
            }
        }
コード例 #2
0
        public DockAreaStyle GetDockAreaStyle(out DockStyle eDockStyle)//获取终级停靠区
        {
            eDockStyle = DockStyle.None;
            if (this.Parent == null)
            {
                return(DockAreaStyle.eNone);
            }
            IDockArea pDockArea = null;

            if (this.Parent is System.Windows.Forms.SplitterPanel)
            {
                pDockArea = this.Parent.Parent as IDockArea;
                if (pDockArea != null)
                {
                    eDockStyle = pDockArea.Dock; return(pDockArea.eDockAreaStyle);
                }
                else
                {
                    return(GetDockAreaStyle(this.Parent.Parent, ref eDockStyle));
                }
            }
            else
            {
                pDockArea = this.Parent as IDockArea;
                if (pDockArea != null)
                {
                    eDockStyle = pDockArea.Dock; return(pDockArea.eDockAreaStyle);
                }
                else
                {
                    return(GetDockAreaStyle(this.Parent, ref eDockStyle));
                }
            }
        }
コード例 #3
0
        public DockAreaStyle GetDockAreaStyle()//获取终级停靠区
        {
            if (this.Parent == null)
            {
                return(DockAreaStyle.eNone);
            }
            IDockArea pDockArea = null;

            if (this.Parent is System.Windows.Forms.SplitterPanel)
            {
                pDockArea = this.Parent.Parent as IDockArea;
                if (pDockArea != null)
                {
                    return(pDockArea.eDockAreaStyle);
                }
                else
                {
                    return(GetDockAreaStyle(this.Parent.Parent));
                }
            }
            else
            {
                pDockArea = this.Parent as IDockArea;
                if (pDockArea != null)
                {
                    return(pDockArea.eDockAreaStyle);
                }
                else
                {
                    return(GetDockAreaStyle(this.Parent));
                }
            }
        }
コード例 #4
0
        private IDockArea GetDockArea_DG(Control ctr)//递归 获取中级停靠区
        {
            if (ctr.Parent == null)
            {
                return(null);
            }
            IDockArea pDockArea = null;

            if (ctr.Parent is System.Windows.Forms.SplitterPanel)
            {
                pDockArea = ctr.Parent.Parent as IDockArea;
                if (pDockArea != null)
                {
                    return(pDockArea);
                }
                else
                {
                    return(GetDockArea_DG(ctr.Parent.Parent));
                }
            }
            else
            {
                pDockArea = ctr.Parent as IDockArea;
                if (pDockArea != null)
                {
                    return(pDockArea);
                }
                else
                {
                    return(GetDockArea_DG(ctr.Parent));
                }
            }
        }
コード例 #5
0
        public IDockArea GetDockArea()//获取中级停靠区
        {
            if (this.Parent == null)
            {
                return(null);
            }
            IDockArea pDockArea = null;

            if (this.Parent is System.Windows.Forms.SplitterPanel)
            {
                pDockArea = this.Parent.Parent as IDockArea;
                if (pDockArea != null)
                {
                    return(pDockArea);
                }
                else
                {
                    return(GetDockArea_DG(this.Parent.Parent));
                }
            }
            else
            {
                pDockArea = this.Parent as IDockArea;
                if (pDockArea != null)
                {
                    return(pDockArea);
                }
                else
                {
                    return(GetDockArea_DG(this.Parent));
                }
            }
        }
コード例 #6
0
        //private void SetMenuItemList(ToolStripMenuItem toolStripMenuItem, ToolStripDropDownItem toolStripDropDownItem)
        //{
        //    if (toolStripDropDownItem == null) return;
        //    //
        //    foreach (ToolStripItem one in toolStripDropDownItem.DropDownItems)
        //    {
        //        System.Windows.Forms.ToolStripMenuItem item = new ToolStripMenuItem(one.Text, null, new EventHandler(DockBarItem_Click));
        //        item.Checked = one.Visible;
        //        item.Tag = one;
        //        toolStripMenuItem.DropDownItems.Add(item);
        //        //
        //        this.SetMenuItemList(item, one as ToolStripDropDownItem);
        //    }
        //}
        private void DockBarItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem one = sender as ToolStripMenuItem;

            if (one == null)
            {
                return;
            }
            ToolStripItem item = one.Tag as ToolStripItem;

            if (item == null)
            {
                return;
            }
            one.Checked  = !one.Checked;
            item.Visible = one.Checked;
            //
            //
            //
            IDockArea pDockArea = this.m_pDockBar.Parent as IDockArea;

            if (pDockArea == null)
            {
                return;
            }
            if (pDockArea.eDockAreaStyle != DockAreaStyle.eDockBarFloatForm)
            {
                return;
            }
            DockBarFloatForm dockBarFloatForm = this.m_pDockBar.Parent as DockBarFloatForm;

            if (dockBarFloatForm == null)
            {
                return;
            }
            if (item.Visible)
            {
                dockBarFloatForm.Width += item.Margin.Left + item.Width + item.Margin.Right;
            }
            else
            {
                dockBarFloatForm.Width -= item.Margin.Left + item.Width + item.Margin.Right;
            }
            dockBarFloatForm.ResetSize();
        }
コード例 #7
0
        private void ResetDockBarItem_Click(object sender, EventArgs e)
        {
            this.m_pDockBar.Reset();
            //
            //
            //
            IDockArea pDockArea = this.m_pDockBar.Parent as IDockArea;

            if (pDockArea == null)
            {
                return;
            }
            if (pDockArea.eDockAreaStyle != DockAreaStyle.eDockBarFloatForm)
            {
                return;
            }
            DockBarFloatForm dockBarFloatForm = this.m_pDockBar.Parent as DockBarFloatForm;

            if (dockBarFloatForm == null)
            {
                return;
            }
            dockBarFloatForm.ResetSize();
        }