private CShotResult[] get_all_shots() { int L = screens.Length; CShotResult[] shots = new CShotResult[L]; for (int i = 0; i < L; i++) { shots[i] = get_shot(screens[i]); } return shots; }
private CShotResult get_shot(Screen screen) { Bitmap bmpShot = new Bitmap( screen.Bounds.Width, screen.Bounds.Height, PixelFormat.Format32bppArgb ); Graphics gfxScreenshot = Graphics.FromImage(bmpShot); gfxScreenshot.CopyFromScreen( screen.Bounds.X, screen.Bounds.Y, 0, 0, screen.Bounds.Size, CopyPixelOperation.SourceCopy ); CShotResult result = new CShotResult(screen.DeviceName, bmpShot); return result; }
public void save_shot(CShotResult ShotResult) { string dir = get_destination_dir(); if (dir != String.Empty) { string filename = dir + '\\' + ShotResult.Name + '_' + DateTime.Now.ToString("yyyyMMdd-HHmmss-fff"); switch (settings.FileFormat) { case CShotActionSettings.IT_JPG: save_as_jpg(ShotResult.Bmp, filename); break; case CShotActionSettings.IT_PNG: save_as_png(ShotResult.Bmp, filename); break; default: save_as_png(ShotResult.Bmp, filename); break; } } }
private void NewFrame_Handler(object sender, NewFrameEventArgs eventArgs) { CShotResult shot = new CShotResult((sender as CMyVideoCaptureDevice).DeviceName, eventArgs.Frame); save_shot(shot); (sender as CMyVideoCaptureDevice).SignalToStop(); }