private void UpdateDragPosition() { if (_dragService == null) { _dragService = new DragService(this); SetIsDragging(true); } var mousePosition = this.TransformToDeviceDPI(Win32Helper.GetMousePosition()); _dragService.UpdateMouseLocation(mousePosition); }
protected virtual IntPtr FilterMessage( IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled ) { handled = false; switch (msg) { case Win32Helper.WM_ACTIVATE: if (((int)wParam & 0xFFFF) == Win32Helper.WA_INACTIVE) { if (lParam == this.GetParentWindowHandle()) { Win32Helper.SetActiveWindow(_hwndSrc.Handle); handled = true; } } break; case Win32Helper.WM_EXITSIZEMOVE: UpdatePositionAndSizeOfPanes(); if (_dragService != null) { bool dropFlag; var mousePosition = this.TransformToDeviceDPI(Win32Helper.GetMousePosition()); _dragService.Drop(mousePosition, out dropFlag); _dragService = null; SetIsDragging(false); if (dropFlag) { InternalClose(); } } break; case Win32Helper.WM_MOVING: { UpdateDragPosition(); } break; case Win32Helper.WM_LBUTTONUP: //set as handled right button click on title area (after showing context menu) if (_dragService != null && Mouse.LeftButton == MouseButtonState.Released) { _dragService.Abort(); _dragService = null; SetIsDragging(false); } break; } return(IntPtr.Zero); }
protected virtual IntPtr FilterMessage( IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled ) { handled = false; switch (msg) { case Win32Helper.WM_ACTIVATE: if (((int)wParam & 0xFFFF) == Win32Helper.WA_INACTIVE) { if (lParam == this.GetParentWindowHandle()) { Win32Helper.SetActiveWindow(_hwndSrc.Handle); handled = true; } } break; case Win32Helper.WM_EXITSIZEMOVE: UpdatePositionAndSizeOfPanes(); if (_dragService != null) { bool dropFlag; var mousePosition = this.TransformToDeviceDPI(Win32Helper.GetMousePosition()); _dragService.Drop(mousePosition, out dropFlag); _dragService = null; SetIsDragging(false); if (dropFlag) InternalClose(); } break; case Win32Helper.WM_MOVING: { UpdateDragPosition(); } break; case Win32Helper.WM_LBUTTONUP: //set as handled right button click on title area (after showing context menu) if (_dragService != null && Mouse.LeftButton == MouseButtonState.Released) { _dragService.Abort(); _dragService = null; SetIsDragging(false); } break; } return IntPtr.Zero; }