Beispiel #1
0
        private void buttonCapture_Click(object sender, EventArgs e)
        {
            Image     image;
            Rectangle rcSelect;

            this.Hide();
            Thread.Sleep(1000);
            if (SnippingTool.Snip(out image, out rcSelect))
            {
                DialogResult  dr;
                ConditionForm conForm = new ConditionForm(rcSelect);
                dr = conForm.ShowDialog();
                if (dr == DialogResult.OK)
                {
                    ProcessModel data = conForm.getResultData();

                    listProcess.Add(data);
                    listBoxCapture.Items.Add(string.Format("{0},threshold:{1}, operation:{2},action:{3}", rcSelect, data.threshold, data.operaion.Value, data.action.Value));
                    if (image != null)
                    {
                        pictureBoxFirstSnip.Image = image;
                    }
                    if (checkBoxShowRealTimeSnip.Checked)
                    {
                        pictureBoxRealtimeSnip.Image = SpecificSnap.Snip(rcSelect);
                    }
                }
                this.Show();
            }
        }
Beispiel #2
0
 private void timerAutoRun_Tick(object sender, EventArgs e)
 {
     foreach (ProcessModel data in listProcess)
     {
         Image image = SpecificSnap.Snip(data.rect);
         if (checkBoxShowRealTimeSnip.Checked)
         {
             pictureBoxRealtimeSnip.Image = image;
         }
         avoidObstacles(image, data);
     }
 }
Beispiel #3
0
        public static Image Snip(Rectangle rcSelect)
        {
            var rc = Screen.PrimaryScreen.Bounds;

            using (Bitmap bmp = new Bitmap(rc.Width, rc.Height, System.Drawing.Imaging.PixelFormat.Format32bppPArgb))
            {
                using (Graphics gr = Graphics.FromImage(bmp))
                    gr.CopyFromScreen(0, 0, 0, 0, bmp.Size);
                SpecificSnap snipper = new SpecificSnap(bmp);
                return(snipper.capture(rcSelect));
            }
        }