How to capture screen with timer using C#?
Posted
by ankush
on Stack Overflow
See other posts from Stack Overflow
or by ankush
Published on 2009-06-12T12:16:08Z
Indexed on
2010/03/30
22:13 UTC
Read the original article
Hit count: 504
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?
© Stack Overflow or respective owner