Exemplo n.º 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //读取配置
            if (Device_control.SettingExist())
            {
                //已有配置
            }
            else
            {
                //初次配置
                //SetMeAutoStart(true);
                //Form3 frm3 = new Form3();
                //frm3.ShowDialog();
            }

            curz = Device_control.LoadSetting();
            //timer1.Start();

            //todo添加判断计算机名重复

            textBox1.Text  = curz.Red_x;
            textBox2.Text  = curz.Red_y;
            textBox3.Text  = curz.Green_x;
            textBox4.Text  = curz.Green_y;
            textBox5.Text  = curz.Blue_x;
            textBox6.Text  = curz.Blue_y;
            textBox7.Text  = curz.Yellow_x;
            textBox8.Text  = curz.Yellow_y;
            textBox9.Text  = curz.Black_x;
            textBox10.Text = curz.Black_y;

            textBox11.Text = curz.x_pixel.ToString();
            //textBox12.Text = curz.y_pixel.ToString();
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            //timer1.Stop();
            //相对路径,和程序exe同目录下
            String Pathcut = "";

            try
            {
                DirectoryInfo dir       = new DirectoryInfo(@"CurCut");
                FileInfo[]    fileInfo  = dir.GetFiles();
                List <string> fileNames = new List <string>();
                String        finalcut  = "";
                foreach (FileInfo item in fileInfo)
                {
                    fileNames.Add(item.Name);

                    finalcut = item.Name;
                }
                Pathcut = @"CurCut\" + finalcut;
            }
            catch
            {
                label1.Text = "请先截图";
                return;
            }

            Bitmap myBitmap = new Bitmap(Pathcut);

            Bitmap myBitmap2 = new Bitmap(myBitmap, curz.x_pixel, curz.x_pixel);

            myBitmap.Dispose();

            Double[,] gray = GetImagePixel_change(myBitmap2);
            int[,] colors  = GetImagePixel_changecolors(myBitmap2);

            int zfe = 1;

            zfe++;

            curz.Red_x    = textBox1.Text;
            curz.Red_y    = textBox2.Text;
            curz.Green_x  = textBox3.Text;
            curz.Green_y  = textBox4.Text;
            curz.Blue_x   = textBox5.Text;
            curz.Blue_y   = textBox6.Text;
            curz.Yellow_x = textBox7.Text;
            curz.Yellow_y = textBox8.Text;
            curz.Black_x  = textBox9.Text;
            curz.Black_y  = textBox10.Text;

            Device_control.mouse_click_fast(gray, colors, curz);

            //if (System.IO.File.Exists(Pathcut))
            //{
            //    System.IO.File.Delete(Pathcut);
            //}
            //timer1.Start();
        }
Exemplo n.º 3
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            Point curpointz = new Point(0, 0);

            Device_control.GetCursorPos(out curpointz);

            label9.Text  = curpointz.X.ToString();
            label10.Text = curpointz.Y.ToString();
        }
Exemplo n.º 4
0
        private void button6_Click(object sender, EventArgs e)
        {
            System.Threading.Thread.Sleep(2000);

            Point curpointz = new Point(0, 0);

            Device_control.GetCursorPos(out curpointz);

            textBox9.Text  = curpointz.X.ToString();
            textBox10.Text = curpointz.Y.ToString();
            saveforms();
        }
Exemplo n.º 5
0
        private void saveforms()
        {
            curz.Red_x    = textBox1.Text;
            curz.Red_y    = textBox2.Text;
            curz.Green_x  = textBox3.Text;
            curz.Green_y  = textBox4.Text;
            curz.Blue_x   = textBox5.Text;
            curz.Blue_y   = textBox6.Text;
            curz.Yellow_x = textBox7.Text;
            curz.Yellow_y = textBox8.Text;
            curz.Black_x  = textBox9.Text;
            curz.Black_y  = textBox10.Text;

            curz.x_pixel = Convert.ToInt32(textBox11.Text);
            curz.y_pixel = Convert.ToInt32(textBox11.Text);


            Device_control.SaveSetting(curz);
        }