private void HandleKeyDownHookEvent(MouseHookEventArgs args) { OnHook?.Invoke(args); lock (downButtons) { // Save button to recognize successfull key presses (down and up) bool added = downButtons.Add(args.Button); if (added) { OnHold?.Invoke(args); } } }
private void HandleKeyReleasedHookEvent(MouseHookEventArgs args) { OnHook?.Invoke(args); lock (downButtons) { bool removed = downButtons.Remove(args.Button); OnRelease?.Invoke(args); if (removed) { OnClick?.Invoke(args); } } }
private void OnLocalMouseMove(MouseHookEventArgs args) { label4.Text = string.Format("Window mouse coords: {0}, {1}", args.X, args.Y); }
private void OnGlobalMouseMove(MouseHookEventArgs args) { label2.Text = string.Format("Current mouse coords: {0}, {1}", args.X, args.Y); label3.Text = string.Format("Absolute mouse coords: {0}, {1}", Sender.AbsoluteX(args.X), Sender.AbsoluteY(args.Y)); }