Пример #1
0
        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();
        }
Пример #2
0
        public void ShowColor()
        {
            if (GlobalVar.W == null || GlobalVar.H == null)
            {
                return;
            }
            Dispatcher?.Invoke(Hide);
            var w      = (int)GlobalVar.W;
            var h      = (int)GlobalVar.H;
            var bitmap = Yx.CopyScreen(0, 0, w, h);

            _cv = new ColorView(bitmap);
            _p  = new PM(bitmap, _cv);
            _cv.Show();
            _p.ShowDialog();
            if (_p.IsClose)
            {
                SetColor();
            }
            Dispatcher?.Invoke(Show);
            _isZt = false;
        }
Пример #3
0
 private void BtnZb_OnClick(object sender, RoutedEventArgs e)
 {
     Yx.SetClipboard(TxtZb.Text);
 }