Example #1
0
        public void CallBack()
        {
            switch (this.now_choose_index)
            {
            case 0:
                int hwnd = WindowLike.get_handle();
                //MessageBox.Show(s[0],s[1]);
                this.now_handle_hwnd = hwnd;
                System.Drawing.Rectangle rec = Screen.GetWorkingArea(this);

                int SH = rec.Height;

                int SW = System.Windows.Forms.SystemInformation.WorkingArea.Width;
                Console.WriteLine(Screen.PrimaryScreen.Bounds.Width.ToString());
                break;

            case 1:
                this.capture();
                break;

            case 2:
                Point p = Mouse.getMousePoint();
                this.textBox_MouseX.Text = p.X.ToString();
                this.textBox_MouseY.Text = p.Y.ToString();
                break;
            }
            //MessageBox.Show("快捷键被调用!");
        }
Example #2
0
        private void capture()
        {
            if (this.now_handle_hwnd == 0)
            {
                MessageBox.Show("请先获取句柄等相关信息");
            }
            else
            {
                Bitmap pic = WindowLike.get_window_pic(new IntPtr(this.now_handle_hwnd), 0, 0);
                if (pic != null)
                {
                    this.now_log = "保存成功" + pic.Width.ToString() + "x" + pic.Height.ToString();

                    this.imageView.Image = pic;

                    FormRect rect = new FormRect();
                    rect = Util.getFormRect(this);

                    //int oldWidth_imageView = this.imageView.Width;
                    //int oldHeight_imageView = this.imageView.Height;
                    //pic = Util.ZoomImage(pic, pic.Width / 5, pic.Height / 5);
                    // 注意先后设置顺序
                    //this.Height = pic.Height - this.imageView.Height + rect.height;
                    //this.Width = pic.Width - this.imageView.Width + rect.width;

                    this.imageView.Height = pic.Height;
                    this.imageView.Width  = pic.Width;
                }
            }
        }
Example #3
0
        private void exec(string[] scriptline)
        {
            switch (scriptline[0])
            {
            case "rightClick":
                dico["rightClick"].DynamicInvoke();
                break;

            case "leftClick":
                dico["leftClick"].DynamicInvoke();
                break;

            case "move":
                if (scriptline.Length == 3)
                {
                    dico["move"].DynamicInvoke(Convert.ToInt32(scriptline[1]), Convert.ToInt32(scriptline[2]));
                }

                else
                {
                    int[] nowPosition = Store.getNow();
                    dico["move"].DynamicInvoke(Convert.ToInt32(nowPosition[0]), Convert.ToInt32(nowPosition[1]));
                }
                break;

            case "wheel":
                dico["wheel"].DynamicInvoke(Convert.ToInt32(scriptline[1]));
                break;

            case "keybd":
                dico["keybd"].DynamicInvoke(scriptline[1]);
                break;

            case "getHandle":
                int hwnd = WindowLike.get_handle_by_name(scriptline[1]);
                this.form1.now_handle_hwnd = hwnd;
                Store.hwdl = hwnd;
                break;

            case "capture":
                this.form1.capture();
                break;

            case "Hwheel":
                Mouse.HWheel(Convert.ToInt32(scriptline[1]));
                break;

            case "reg":
                int[] pos = Recognition.recognize((scriptline[1]));
                Store.mock_position(pos[0], pos[1]);
                break;

            case "rwheel":
                Mouse.mockHRwheel();
                break;
            }
            System.Threading.Thread.Sleep(1000);
        }