/// <summary> /// End window movement /// </summary> public void EndWindowMovement() { if (_movedWindow == null) { return; } Point screenLocation = Control.MousePosition; DockAllowed allowedDock = _allowedDock; if (GetContainerUnderMouse(screenLocation) != null) { allowedDock = DockAllowed.All; } GuidedDockResult result = _guider.GetDockResult(allowedDock, screenLocation); Control movedControl = _movedWindow; StopMovement(); _movedWindow = null; EventHandler <DockControlEventArgs> handler = ApplyDock; if (handler != null && result.Dock != DockStyle.None) { DockControlEventArgs args = new DockControlEventArgs(movedControl, result.Dock, result.DockMode); handler(this, args); } }
/// <summary> /// Move a window using mouse /// </summary> public void MoveWindowByMouse() { if (_movedWindow == null) { return; } DockAllowed allowedDock = _allowedDock; Point screenLocation = Control.MousePosition; DockingContainer containerUnderMouse = GetContainerUnderMouse(screenLocation); Rectangle fillRectangle = FormWrapper.GetFillRectangleFromPoint(screenLocation, containerUnderMouse, _host); if (fillRectangle.IsEmpty) { _guider.HideCenterGuider(); } else { if (containerUnderMouse == null) { _guider.ShowCenterGuider(allowedDock, fillRectangle); } else { allowedDock = DockAllowed.All; _guider.ShowCenterGuider(allowedDock, fillRectangle); } } GuidedDockResult result = _guider.GetDockResult(allowedDock, screenLocation); if (result.DockMode == DockableMode.Outer && result.Dock != DockStyle.None) { Rectangle bounds = OuterDockPreviewEngine.GetPreviewBounds(result.Dock, _host, _movedWindow); _guider.ShowPreviewPanel(bounds); } else if (result.DockMode == DockableMode.Inner && result.Dock != DockStyle.None) { Rectangle freeBounds = FormWrapper.GetFillScreenRectangle(_host); Rectangle bounds = InnerDockPreviewEngine.GetPreviewBounds(result.Dock, _movedWindow, containerUnderMouse, freeBounds); if (bounds.IsEmpty) { _guider.HidePreviewPanel(); } else { _guider.ShowPreviewPanel(bounds); } } else { _guider.HidePreviewPanel(); } }