Ejemplo n.º 1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            string file = @"C:\Users\MYL\Desktop\Jumpnn1.jpg";

            using (Bitmap bmp = ScreenSnapUtil.Snap(""))
            {
                if (null == bmp)
                {
                    return;
                }
                Point p = ImageUtil.GetNextCenter(bmp);
                if (p.X < 0 || p.Y < 0)
                {
                    return;
                }
                using (Graphics g = Graphics.FromImage(bmp))
                {
                    Pen pen = new Pen(Color.Red);
                    g.DrawEllipse(pen, p.X, p.Y, 20, 20);
                }
                //this.pictureBox1.Image = null;
                //bmp.Save(file, ImageFormat.Jpeg);
                //this.pictureBox1.Image = Image.FromFile(file);
                this.pictureBox1.Image = (Image)bmp.Clone();
                Console.WriteLine(p);
            }
        }
Ejemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            Bitmap bmp = ScreenSnapUtil.Snap("");

            if (null != bmp)
            {
                bmp.Save(@"C:\Users\MYL\Desktop\Jumpnn.jpg", ImageFormat.Jpeg);
            }
        }