protected void MouseEventTranslator_MouseDown(object sender, MouseMessageEventArgs e) { // Disregard all but capture button events if (e.Button != MouseButtons.Right) { return; } // Can we begin a new gesture capture if (State == CaptureState.Ready) { Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High; // Store original mouse message _OriginalMessage = e.MouseMessage; // Try to begin capture process, if capture started then don't notify other applications of a mouse event, otherwise do e.Handled = TryBeginCapture(e.Location); if (!e.Handled) { Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Normal; } } }
private void MouseHook_MessageReceived(object sender, MouseMessageEventArgs e) { mouseLabel.Dispatcher.BeginInvoke(new Action(() => { mouseLabel.Content = $"Code: {e.MessageCode}; X: {e.X}; Y: {e.Y}; Delta: {e.Delta}"; })); }
private void MouseHook_NCLButtonUp(object sender, MouseMessageEventArgs e) { testLabel.Dispatcher.BeginInvoke(new Action(() => { testLabel.Content = $"Code: {e.MessageCode}; X: {e.X}; Y: {e.Y}; Delta: {e.Delta}"; })); }
private void MouseHook_ButtonDown(object sender, MouseMessageEventArgs e) { testLabel.Invoke((MethodInvoker) delegate { testLabel.Text = $"Mouse Message Code DOWNNNN: {e.MessageCode}; X: {e.X}; Y: {e.Y}; Delta: {e.Delta}"; }); }
protected virtual void OnMouseMove(MouseMessageEventArgs args) { if (MouseMove != null) { MouseMove(this, args); } }
/// <summary> /// Handles the MouseMove event of the MouseHook control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="MouseMessageEventArgs"/> instance containing the event data.</param> private void MouseHook_MouseMove(object sender, MouseMessageEventArgs e) { this._x = e.X; this._y = e.Y; this.MouseMove?.Invoke(this, e); }
private void MouseHook_MessageReceived(object sender, MouseMessageEventArgs e) { mouseLabel.Invoke((MethodInvoker) delegate { mouseLabel.Text = $"Mouse Message Code: {e.MessageCode}; X: {e.X}; Y: {e.Y}; Delta: {e.Delta}"; }); }
protected void MouseEventTranslator_MouseUp(object sender, MouseMessageEventArgs e) { // Disregard all but right MouseUp events if (e.Button != MouseButtons.Right) { return; } // Replay original event if capturing was invalid, otherwise // successfully end the capture process and handle this MouseUp event switch (State) { case CaptureState.CapturingInvalid: ReplyOriginalEvent(); Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Normal; break; case CaptureState.Capturing: EndCapture(); Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Normal; e.Handled = true; break; } }
protected void MouseEventTranslator_MouseMove(object sender, MouseMessageEventArgs e) { // Only add point if we're capturing if (State == CaptureState.Capturing || State == CaptureState.CapturingInvalid) { AddPoint(e.Location); } }
private void MouseHook_NCLButtonUp(object sender, MouseMessageEventArgs e) { testLabel.Invoke((MethodInvoker) delegate { testLabel.Text = $"Code: {e.MessageCode}; X: {e.X}; Y: {e.Y}; " + $"Modifiers: {e.Modifiers:x}; Delta: {e.Delta}; XButtons: {e.XButtons}"; }); }
/// <summary> /// Handles the RightButtonUp event of the MouseHook control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="MouseMessageEventArgs"/> instance containing the event data.</param> private async void MouseHook_RightButtonUp(object sender, MouseMessageEventArgs e) { if (e.Alt && this._settingsService.SearchEnabled) { await Task.Delay(100); var item = await this.ParseItem(); if (item != null) { this.ItemDetails?.Invoke(this, item); } ClipboardHelper.ClearClipboard(); } }
/// <summary> /// Handles the MouseLeftButtonUp event of the MouseHookService control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private async void MouseHook_LeftButtonUp(object sender, MouseMessageEventArgs e) { if (e.Shift && this._settingsService.MapEnabled) { await Task.Delay(100); var item = await this.ParseItem(); if (item != null) { this.ItemIdentified?.Invoke(this, item); } ClipboardHelper.ClearClipboard(); } }
/// <summary> /// Handles the MouseLeftButtonUp event of the MouseHookService control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private async void MouseHook_LeftButtonUp(object sender, MouseMessageEventArgs e) { this.MouseLeftButtonUp?.Invoke(this, e); if (e.Control || !e.Shift || (!this._settingsService.MapEnabled && !this._settingsService.SearchEnabled)) { return; } await Task.Delay(100); var item = await this.ParseItem(); if (item != null) { this.ItemIdentified?.Invoke(this, item); } ClipboardHelper.ClearClipboard(); }
/// <summary> /// Handles the MouseMove event of the MouseLurker control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="MouseMessageEventArgs"/> instance containing the event data.</param> private void MouseLurker_MouseMove(object sender, MouseMessageEventArgs e) { var rayon = this._width / 2; var center = new Position() { X = (int)(this._x + rayon), Y = (int)(this._y + (this._height / 2)), }; var differenceX = System.Math.Abs(center.X - e.X); var differenceY = System.Math.Abs(center.Y - e.Y); var hypothenuse = System.Math.Sqrt(System.Math.Pow(differenceX, 2) + System.Math.Pow(differenceY, 2)); var difference = MouseMargin + rayon - hypothenuse + 30; if (difference <= 0) { this.ClearContent(); } else { this.Opacity = difference / MouseMargin; } }
private void MouseHook_MessageReceived(object sender, MouseMessageEventArgs e) { // Debug.WriteLine($"Mouse Message Code: {e.MessageCode}; X: {e.X}; Y: {e.Y}; Delta: {e.Delta}"); }
public void TranslateMouseEvent(LowLevelMouseMessage Message) { // Store which mouse event occured MouseEvent = (MouseEvents)Message.Message; // Define new MouseMessageEventArgs to get handled state MouseMessageEventArgs args = null; switch (MouseEvent) { case MouseEvents.LeftButtonDown: args = new MouseMessageEventArgs(MouseButtons.Left, 1, Message.Point.X, Message.Point.Y, 0, Message); OnMouseDown(args); break; case MouseEvents.LeftButtonUp: args = new MouseMessageEventArgs(MouseButtons.Left, 1, Message.Point.X, Message.Point.Y, 0, Message); OnMouseUp(args); break; case MouseEvents.RightButtonDown: args = new MouseMessageEventArgs(MouseButtons.Right, 1, Message.Point.X, Message.Point.Y, 0, Message); OnMouseDown(args); break; case MouseEvents.RightButtonUp: args = new MouseMessageEventArgs(MouseButtons.Right, 1, Message.Point.X, Message.Point.Y, 0, Message); OnMouseUp(args); break; case MouseEvents.MiddleButtonDown: args = new MouseMessageEventArgs(MouseButtons.Middle, 1, Message.Point.X, Message.Point.Y, 0, Message); OnMouseDown(args); break; case MouseEvents.MiddleButtonUp: args = new MouseMessageEventArgs(MouseButtons.Middle, 1, Message.Point.X, Message.Point.Y, 0, Message); OnMouseUp(args); break; case MouseEvents.Move: args = new MouseMessageEventArgs(MouseButtons.None, 0, Message.Point.X, Message.Point.Y, 0, Message); OnMouseMove(args); break; default: args = new MouseMessageEventArgs(MouseButtons.None, 0, 0, 0, 0, Message); // Catch additional buttons break; } // Set handled property of class to MouseMessageEventArgs handled flag to notify the main mouse intercept that one of the events handled it this.Handled = args.Handled; }
private void MouseHook_ButtonDown(object sender, MouseMessageEventArgs e) { Debug.WriteLine($"Mouse Message DOWWWWWWN Code: {e.MessageCode}; X: {e.X}; Y: {e.Y}; Delta: {e.Delta}"); }