private void StartDrag(CrownDockSplitter splitter) { _activeSplitter = splitter; Cursor.Current = _activeSplitter.ResizeCursor; _initialContact = Cursor.Position; _isDragging = true; _activeSplitter.ShowOverlay(); _dragTimer.Start(); }
private void CheckCursor() { if (_isDragging) { return; } CrownDockSplitter hotSplitter = HotSplitter(); if (hotSplitter != null) { Cursor.Current = hotSplitter.ResizeCursor; } }
public bool PreFilterMessage(ref Message m) { // We only care about mouse events if (!(m.Msg == (int)WM.MOUSEMOVE || m.Msg == (int)WM.LBUTTONDOWN || m.Msg == (int)WM.LBUTTONUP || m.Msg == (int)WM.LBUTTONDBLCLK || m.Msg == (int)WM.RBUTTONDOWN || m.Msg == (int)WM.RBUTTONUP || m.Msg == (int)WM.RBUTTONDBLCLK)) { return(false); } // Stop drag. if (m.Msg == (int)WM.LBUTTONUP) { if (_isDragging) { StopDrag(); return(true); } } // Exit out early if we're simply releasing a non-splitter drag over the area if (m.Msg == (int)WM.LBUTTONUP && !_isDragging) { return(false); } // Force cursor if already dragging. if (_isDragging) { Cursor.Current = _activeSplitter.ResizeCursor; } // Return out early if we're dragging something that's not a splitter. if (m.Msg == (int)WM.MOUSEMOVE && !_isDragging && _dockPanel.MouseButtonState != MouseButtons.None) { return(false); } // Try and create a control from the message handle. Control control = Control.FromHandle(m.HWnd); // Exit out if we didn't manage to create a control. if (control == null) { return(false); } // Exit out if the control is not the dock panel or a child control. if (!(control == _dockPanel || _dockPanel.Contains(control))) { return(false); } // Update the mouse cursor CheckCursor(); // Start drag. if (m.Msg == (int)WM.LBUTTONDOWN) { CrownDockSplitter hotSplitter = HotSplitter(); if (hotSplitter != null) { StartDrag(hotSplitter); return(true); } } // Stop events passing through if we're hovering over a splitter if (HotSplitter() != null) { return(true); } // Stop all events from going through if we're dragging a splitter. if (_isDragging) { return(true); } return(false); }