private void PaneSplitter_BeginDrag(Point ptSplitter) { m_splitterLocation = DragControl.Parent.PointToScreen(ptSplitter); Point ptMouse = StartMousePosition; m_mouseOffset.X = m_splitterLocation.X - ptMouse.X; m_mouseOffset.Y = m_splitterLocation.Y - ptMouse.Y; Rectangle rect = GetPaneSplitterDragRectangle(); DragOutline = DrawHelper.CreateDragOutline(rect, OutlineBorderWidth); }
private void Pane_OnDragging() { Point ptMouse = Control.MousePosition; DockPane pane = (DockPane)DragControl; if (!TestDrop(ptMouse)) { return; } if (DropTarget.DropTo == null) { if (IsDockStateValid(DockState.Float)) { Point location = new Point(ptMouse.X + m_mouseOffset.X, ptMouse.Y + m_mouseOffset.Y); Size size; if (pane.FloatWindow == null) { size = FloatWindow.DefaultWindowSize; } else if (pane.FloatWindow.DisplayingList.Count == 1) { size = pane.FloatWindow.Size; } else { size = FloatWindow.DefaultWindowSize; } if (ptMouse.X > location.X + size.Width) { location.X += ptMouse.X - (location.X + size.Width) + OutlineBorderWidth; } Rectangle rect = new Rectangle(location, size); DragOutline = DrawHelper.CreateDragOutline(rect, OutlineBorderWidth); } else { DragOutline = null; } } if (DragOutline == null) { User32.SetCursor(Cursors.No.Handle); } else { User32.SetCursor(DragControl.Cursor.Handle); } }
private void FloatWindow_OnDragging() { Point ptMouse = Control.MousePosition; if (!TestDrop(ptMouse)) { return; } if (DropTarget.DropTo == null) { Rectangle rect = DragControl.Bounds; rect.X = ptMouse.X + m_mouseOffset.X; rect.Y = ptMouse.Y + m_mouseOffset.Y; DragOutline = DrawHelper.CreateDragOutline(rect, OutlineBorderWidth); } }
internal void TestDrop(DragHandler dragHandler, Point pt) { if (DockArea.Width <= 0 || DockArea.Height <= 0) { return; } Point ptClient = PointToClient(pt); int dragSize = MeasurePane.DragSize; Rectangle rectDoc = DocumentRectangle; if (ptClient.Y - rectDoc.Top >= 0 && ptClient.Y - rectDoc.Top < dragSize && DockWindows[DockState.DockTop].DisplayingList.Count == 0 && dragHandler.IsDockStateValid(DockState.DockTop)) { dragHandler.DropTarget.SetDropTarget(this, DockStyle.Top); } else if (rectDoc.Bottom - ptClient.Y >= 0 && rectDoc.Bottom - ptClient.Y < dragSize && DockWindows[DockState.DockBottom].DisplayingList.Count == 0 && dragHandler.IsDockStateValid(DockState.DockBottom)) { dragHandler.DropTarget.SetDropTarget(this, DockStyle.Bottom); } else if (rectDoc.Right - ptClient.X >= 0 && rectDoc.Right - ptClient.X < dragSize && DockWindows[DockState.DockRight].DisplayingList.Count == 0 && dragHandler.IsDockStateValid(DockState.DockRight)) { dragHandler.DropTarget.SetDropTarget(this, DockStyle.Right); } else if (ptClient.X - rectDoc.Left >= 0 && ptClient.X - rectDoc.Left < dragSize && DockWindows[DockState.DockLeft].DisplayingList.Count == 0 && dragHandler.IsDockStateValid(DockState.DockLeft)) { dragHandler.DropTarget.SetDropTarget(this, DockStyle.Left); } else if (((ptClient.Y - rectDoc.Top >= dragSize && ptClient.Y - rectDoc.Top < 2 * dragSize) || (rectDoc.Bottom - ptClient.Y >= dragSize && rectDoc.Bottom - ptClient.Y < 2 * dragSize) || (rectDoc.Right - ptClient.X >= dragSize && rectDoc.Right - ptClient.X < 2 * dragSize) || (ptClient.X - rectDoc.Left >= dragSize && ptClient.X - rectDoc.Left < 2 * dragSize)) && DockWindows[DockState.Document].DisplayingList.Count == 0 && dragHandler.IsDockStateValid(DockState.Document)) { dragHandler.DropTarget.SetDropTarget(this, DockStyle.Fill); } else { return; } if (dragHandler.DropTarget.SameAsOldValue) { return; } Rectangle rect = DockArea; if (dragHandler.DropTarget.Dock == DockStyle.Top) { rect.Height = (int)(DockArea.Height * DockTopPortion); } else if (dragHandler.DropTarget.Dock == DockStyle.Bottom) { rect.Height = (int)(DockArea.Height * DockBottomPortion); rect.Y = DockArea.Bottom - rect.Height; } else if (dragHandler.DropTarget.Dock == DockStyle.Left) { rect.Width = (int)(DockArea.Width * DockLeftPortion); } else if (dragHandler.DropTarget.Dock == DockStyle.Right) { rect.Width = (int)(DockArea.Width * DockRightPortion); rect.X = DockArea.Right - rect.Width; } else if (dragHandler.DropTarget.Dock == DockStyle.Fill) { rect = DocumentRectangle; } rect.Location = PointToScreen(rect.Location); dragHandler.DragOutline = DrawHelper.CreateDragOutline(rect, dragSize); }
private void PaneSplitter_OnDragging() { Rectangle rect = GetPaneSplitterDragRectangle(); DragOutline = DrawHelper.CreateDragOutline(rect, OutlineBorderWidth); }
private void AutoHideWindowSplitter_OnDragging() { Rectangle rect = GetWindowSplitterDragRectangle(); DragOutline = DrawHelper.CreateDragOutline(rect, OutlineBorderWidth); }