Example #1
0
        private void MoveCursor()
        {
            String aa = builder.ToString();

            aa = aa.Replace(" ", "");
            String aax_Hex;
            String aay_Hex;
            String aa_state_Hex;

            try
            {
                aax_Hex      = aa.Substring(aa.Length - 22, 4);
                aay_Hex      = aa.Substring(aa.Length - 18, 4);
                aa_state_Hex = aa.Substring(aa.Length - 24, 2);
            }
            catch
            {
                return;
            }


            int aax_decimal = Convert.ToInt32(aax_Hex, 16);
            int aay_decimal = Convert.ToInt32(aay_Hex, 16);



            this.Cursor     = new Cursor(Cursor.Current.Handle);
            Cursor.Position = new Point(aax_decimal, aay_decimal);

            if (aa_state_Hex.Equals("01"))
            {
                SendMouseEvent.LeftDown();
            }
            else if (aa_state_Hex.Equals("04"))
            {
                SendMouseEvent.LeftUp();
            }


            String bbx_Hex;
            String bby_Hex;
            String bb_state_Hex;


            try
            {
                bbx_Hex      = aa.Substring(aa.Length - 10, 4);
                bby_Hex      = aa.Substring(aa.Length - 6, 4);
                bb_state_Hex = aa.Substring(aa.Length - 12, 2);
            }
            catch
            {
                return;
            }


            int bbx_decimal = Convert.ToInt32(bbx_Hex, 16);
            int bby_decimal = Convert.ToInt32(bby_Hex, 16);
        }
        private void MoveCursor()
        {
            String aa = builder.ToString();                              //提取 收到的 数据  字符串格式

            aa = aa.Replace(" ", "");                                    //去空格
            String aax_Hex;
            String aay_Hex;
            String aa_state_Hex;

            try
            {
                aax_Hex      = aa.Substring(aa.Length - 22, 4);         //x坐标
                aay_Hex      = aa.Substring(aa.Length - 18, 4);         //y坐标
                aa_state_Hex = aa.Substring(aa.Length - 24, 2);         //状态判断
            }
            catch
            {
                return;                                              //规避 报错 (有时候数据发错 导致index 负数报错)
            }


            int aax_decimal = Convert.ToInt32(aax_Hex, 16);         //坐标x  string 转int 后边好定位
            int aay_decimal = Convert.ToInt32(aay_Hex, 16);



            this.Cursor     = new Cursor(Cursor.Current.Handle);
            Cursor.Position = new Point(aax_decimal, aay_decimal);          //定位

            if (aa_state_Hex.Equals("01"))
            {
                SendMouseEvent.LeftDown();                                  //发送数据 状态位01 时  按下左键 模拟点击
            }
            else if (aa_state_Hex.Equals("04"))
            {
                SendMouseEvent.LeftUp();
            }
        }