protected override void OnMouseDown(MouseEventArgs e) { for (int i = 0; i < toolStripManager.DockingSites.Count; i++) { RadToolStrip toolStripUnderMouseCursor = toolStripManager.DockingSites[i] as RadToolStrip; toolStripUnderMouseCursor.Focus(); } if (e.Button == MouseButtons.Left) { switch (this.directionToResize) { case ResizeDirection.None: { this.InitializeMove(this.PointToScreen(e.Location)); break; } case ResizeDirection.Right: case ResizeDirection.Left: Cursor.Current = Cursors.SizeWE; break; case ResizeDirection.Top: case ResizeDirection.Bottom: Cursor.Current = Cursors.SizeNS; break; } } base.OnMouseDown(e); }
private void PerformDocking() { RadToolStrip toolStripUnderMouseCursor = null; RadToolStripItem item = new RadToolStripItem(); if (this.directionToResize == ResizeDirection.None) { for (int i = 0; i < toolStripManager.DockingSites.Count; i++) { toolStripUnderMouseCursor = toolStripManager.DockingSites[i] as RadToolStrip; toolStripUnderMouseCursor.Focus(); if (toolStripUnderMouseCursor.ToolStripManager.Orientation == Orientation.Horizontal) { toolStripUnderMouseCursor.ToolStripManager.resizeTimer.Interval = 10; } else { toolStripUnderMouseCursor.ToolStripManager.resizeTimer.Interval = 10; } Rectangle rangeRect = toolStripUnderMouseCursor.RectangleToScreen(toolStripUnderMouseCursor.ClientRectangle); int edgeOffset = 20; if (toolStripUnderMouseCursor.ToolStripManager.Orientation == Orientation.Horizontal) { rangeRect = new Rectangle(rangeRect.X, rangeRect.Y - edgeOffset, rangeRect.Width, rangeRect.Height + 2 * edgeOffset); } else { rangeRect = new Rectangle(rangeRect.X - edgeOffset, rangeRect.Y, rangeRect.Width + edgeOffset, rangeRect.Height); } if (rangeRect.Height == 0) { rangeRect = new Rectangle(rangeRect.X, rangeRect.Y, rangeRect.Width, rangeRect.Height + edgeOffset); } else if (rangeRect.Width == 0) { rangeRect = new Rectangle(rangeRect.X - edgeOffset, rangeRect.Y, rangeRect.Width + 2 * edgeOffset, rangeRect.Height); } if (this.Controls.Count > 0) { if ((this.Controls[0] as RadToolStripItemControl).Items.Count > 0) { if (rangeRect.Contains(Cursor.Position)) { item.FloatingFormPreferredSize = this.Size; item.ShrinkWidths = this.shrinkWidths; item.FloatingCloseButton.Visible = this.Controls[1].Visible; item.FloatingOverFlowButton.Visible = this.Controls[2].Visible; InsertToAppropriatePosition(toolStripUnderMouseCursor.ToolStripManager, item, rangeRect); item.Key = this.Key; this.InitializeToolStripItem(item, toolStripUnderMouseCursor); this.Capture = false; this.Controls.Clear(); this.Close(); } } } } } }