-3

How to save screenshots automatically?

(if label1.Text=="Sam")//takes a screen shot for the form
if(label1.Text=="Julia")//takes a screen shot for the form

and so on...

Screen shots are taken and being saved in a specific path I define at first.

This means when I open the application I define a path that the screenshots will be saved to. Then, when I click a button screenshots are being saved to the path I defined before, and I will not do anything more to save screenshots. They are saved automatically.

How to make that, please? Amen

TimoStaudinger
  • 41,396
  • 16
  • 88
  • 94
Amento
  • 1
  • 1

1 Answers1

0
Rectangle bounds = this.Bounds;
using (Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height))
{
    using (Graphics g = Graphics.FromImage(bitmap))
    {
        g.CopyFromScreen(new Point(bounds.Left,bounds.Top), Point.Empty, bounds.Size);
    }
    bitmap.Save("C://test.jpg", ImageFormat.Jpeg);

}

taken from Capture screenshot of active window?

Community
  • 1
  • 1
Vishal Patel
  • 130
  • 1
  • 2
  • 10
  • Sorry, this code will save only One screenshot to this path, but what I want to do is as following: 1-I want to write the path myself in a textbox and when I click a button 2-The applications starts to take ScreenShots each time the condition I define is true..consider the condition is:(if label1.text=="sam")..then the application takes a screenshot and save it to a folder which I defined the path for in the textbox...or if there is another way to define the path myself like savefiledialog...but I want to define the path one time..only one time..and all screenshots will be saved there...Thanks – Amento May 22 '15 at 03:08
  • And yes..of Active window – Amento May 22 '15 at 03:09