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)); } } }
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)); } } }
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)); } } }
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)); } } }
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)); } } }
//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(); }
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(); }