这是一个使用C#的Windows应用程序。我想用计时器捕捉屏幕截图。计时器设置为5000毫秒的时间间隔。随着计时器启动,应使用源窗口标题捕获桌面屏幕。如何用C#定时器捕获屏幕?
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;
}
此代码无法正常工作。我怎样才能使它工作?
“while”循环应该做什么? – 2009-06-12 12:18:34
你能否更具体地说明“不能正常工作”的含义。 – ChrisF 2009-06-12 12:20:35