/// <summary> /// Handle the mouse up on the Pipette "label", we release the capture and fire the PipetteUsed event /// </summary> /// <param name="e">MouseEventArgs</param> protected override void OnMouseUp(MouseEventArgs e) { if (e.Button == MouseButtons.Left) { //Release Capture should consume MouseUp when canceled with the escape key User32Api.ReleaseCapture(); PipetteUsed?.Invoke(this, new PipetteUsedArgs(_movableShowColorForm.ColorUnderCursor)); } base.OnMouseUp(e); }
public bool PreFilterMessage(ref Message m) { if (_dragging) { if (m.Msg == (int)WindowsMessages.WM_CHAR) { if ((int)m.WParam == VkEsc) { User32Api.ReleaseCapture(); } } } return(false); }