/// <summary> /// マウスの右ボタンでクリックしたときの処理です /// </summary> /// <param name="mouseEvent"></param> protected void OnMouseRightClick(MouseEvent mouseEvent) { if (MouseRightClick != null) { MouseRightClick.Invoke(this, mouseEvent); } }
private TrayIcon() { trayIcon.MouseClick += (p1, p2) => { if (p2.Button == MouseButtons.Left) { MouseLeftClick?.Invoke(p1, p2); } else if (p2.Button == MouseButtons.Right) { MouseRightClick?.Invoke(p1, p2); } }; }
protected void MouseEvent(int x1, int y1, int x2, int y2) { if (MouseInArea(x1, y1, x2, y2)) { if ((NativeMethods.GetAsyncKeyState(KeyCode.MS_Click1) & 1) != 0) { MouseLeftClick?.Invoke(this); } else if ((NativeMethods.GetAsyncKeyState(KeyCode.MS_Click2) & 1) != 0) { MouseRightClick?.Invoke(this); } else if ((NativeMethods.GetAsyncKeyState(KeyCode.MS_Click1) & 0x8000) != 0) { MouseMove?.Invoke(this); } } }
/// <summary>Raise the MouseRightClick event.</summary> protected virtual void OnMouseRightClick(HexEventArgs e) { MouseRightClick.Raise(this, e); }
//this gets called by GLFW (unmanaged code) private void MouseCallback(int btn, int action, int mods) { //scroll (3 was chosen by me, not glfw) if (btn == 3) { MouseScrolled.Invoke(action, this); MouseScrollDirection = action; return; } //left click if (btn == 0 && action == 1) { if (leftLifted) { MouseLeftClick.Invoke(MousePosition, this); MouseLeftClickScaled.Invoke(MousePositionScaled, this); iLastLeft = MousePosition; leftClickToggle = true; } leftLifted = false; } if (btn == 0 && action == 0) { leftLifted = true; MouseLeftRelease.Invoke(MousePosition, this); MouseLeftReleaseScaled.Invoke(MousePositionScaled, this); return; } //right click if (btn == 1 && action == 1) { if (rightLifted) { MouseRightClick.Invoke(MousePosition, this); MouseRightClickScaled.Invoke(MousePositionScaled, this); iLastRight = MousePosition; rightClickToggle = true; } rightLifted = false; return; } if (btn == 1 && action == 0) { rightLifted = true; MouseRightRelease.Invoke(MousePosition, this); MouseRightReleaseScaled.Invoke(MousePositionScaled, this); return; } //middle click if (btn == 2 && action == 1) { if (middleLifted) { MouseMiddleClick.Invoke(MousePosition, this); MouseMiddleClickScaled.Invoke(MousePositionScaled, this); } middleLifted = false; return; } if (btn == 2 && action == 0) { middleLifted = true; MouseMiddleRelease.Invoke(MousePosition, this); MouseMiddleReleaseScaled.Invoke(MousePositionScaled, this); return; } }