How to capture screen with timer using C#?
- by ankush
This is a Windows application using C#. I want to capture a screen shot with a timer. The timer is set to a 5000 ms interval. As the timer is started, the desktop screen should be captured with the source window caption.
try
{
System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
timer.Tick += new EventHandler(timer2_Tick);
timer.Interval = (100) * (50);
timer.Enabled = true;
timer.Start();
ScreenShots sc = new ScreenShots();
sc.pictureBox1.Image = system_serveillance.CaptureScreen.GetDesktopImage();
while(sc.pictureBox1.Image != null)
{
sc.pictureBox1.Image.Save("s"+".jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
sc.pictureBox1.Image = null;
}
This code is not working properly. How can I make it work?