剛剛測試了一下程式,發現記憶體越吃越兇...
於是修正一下程式
打開Source Code Form1.cs 修正底下(粗體字部分 請新增即可)
private void timer_Capture_Tick(object sender, EventArgs e)
{
Bitmap bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
Graphics gfxScreenshot = Graphics.FromImage(bmpScreenshot);
gfxScreenshot = Graphics.FromImage(bmpScreenshot);
gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
string FileName = Path.Combine(textBox_FolderName.Text,string.Format(@"{0}.jpg", DateTime.Now.Ticks.ToString()));
bmpScreenshot.Save(FileName, System.Drawing.Imaging.ImageFormat.Png);
bmpScreenshot.Dispose();
gfxScreenshot.Dispose();
}
private void timer_checkESC_Tick(object sender, EventArgs e)
{
Application.DoEvents();
GC.Collect();
if (StopFlg)
EndProcess();
}
不想修改者,這裡直接下再使用...
程式[MD5 : baac548d02f802c73640f5feda7a53a6]
0 個回應:
張貼留言