public MainWindow() { InitializeComponent(); _hk = new HookHelper(); _hk.KeyDownEvent += (o, e) => { switch (e.KeyCode) { case Keys.F8: Qs(); break; case Keys.Escape: _p?.Close(); _cv?.Close(); _isZt = false; break; case Keys.Enter: if (_isZt) { SetColor(); } _p?.Close(); _cv?.Close(); _isZt = false; break; case Keys.Up: Yx.GetCursorPos(out var x, out var y); Yx.MoveTo(x, y - 1); break; case Keys.Down: Yx.GetCursorPos(out x, out y); Yx.MoveTo(x, y + 1); break; case Keys.Left: Yx.GetCursorPos(out x, out y); Yx.MoveTo(x - 1, y); break; case Keys.Right: Yx.GetCursorPos(out x, out y); Yx.MoveTo(x + 1, y); break; case Keys.F7: Yx.MoveWindow(Yx.FindWindowCursor(), 0, 0); break; } }; _hk.SetHook(); }
private void PM_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { IsClose = true; _cv.Close(); Close(); } else { _cv.Close(); Close(); } }