private void _toolStripCaption_CaptionDrag(object sender, MouseEventArgs e) { Point pointInScreen = this.PointToScreen(e.Location); DockControlContainer container = _manager.GetContainerAtPoint(_manager.PointToClient(pointInScreen)); if (container == null) { Rectangle dragRectangle = DockControlHelpers.GetDropXorDragRect(_manager, pointInScreen, DockingBarSize); if (!dragRectangle.IsEmpty) { _dragger.SetRectangle(_manager.RectangleToScreen(dragRectangle)); return; } } else { Rectangle rectangleToDraw = GetContainerDragDrawRectangle(container, pointInScreen); if (!rectangleToDraw.IsEmpty) { _dragger.SetRectangle(rectangleToDraw); return; } if (container.Tabbed) { _dragger.SetRectangle(container.RectangleToScreen(container.ClientRectangle)); return; } else { DockingControl control = container.GetDockingControlAtPoint(container.PointToClient(pointInScreen)); if (control != null) { Point pointInControl = control.PointToClient(pointInScreen); rectangleToDraw = GetContolDragDrawRectangle(container, control, pointInControl); _dragger.SetRectangle(control.RectangleToScreen(rectangleToDraw)); return; } } } _dragger.MoveTo(e.Location); }
protected virtual void OnEndCaptionDrag(Point dropPoint, Rectangle endDragBounds) { using (RedrawStopper stopRedraws = new RedrawStopper(_manager, true)) { DockControlContainer container = GetDropContainer(dropPoint); if (container == null) { endDragBounds.X -= FloatingForm.PaddingSize; endDragBounds.Y -= FloatingForm.PaddingSize; endDragBounds.Width += 2 * FloatingForm.PaddingSize; endDragBounds.Height += 2 * FloatingForm.PaddingSize; FloatControl(endDragBounds); } else { int dimension = DockControlHelpers.GetDockedDimension(this, container.Dock); container = DockControlHelpers.CreateNewContainerIfNecessary(_manager, container, PointToScreen(dropPoint), DockingBarSize); DockControl(dropPoint, container, dimension); RemoveFloatingForm(); } } }
private DockControlContainer GetDropContainer(Point dropPoint) { return(DockControlHelpers.GetDropContainer(_manager, PointToScreen(dropPoint), DockingBarSize)); }
private void _controlList_ControlAdded(DockedControlCollection list, DockingControl control) { _inExternalAddControl = true; AddControl(control, -1, DockControlHelpers.GetDockedDimension(control, this.Dock)); _inExternalAddControl = false; }