// Takes a screenshot of the SnapRegion and returns it private Image Snap() { bool VfwWasVisible = vfw.Visible; if (VfwWasVisible) { vfw.Visible = false; // Hide viewfinder if appropriate } this.Visible = false; // Hide self (nobody wants to translate Babel) try { if ((int)TrackingWindow != 0) { // Put this into a general function later Rectangle WindowLoc = WindowFunctions.GetRectFromHwnd(TrackingWindow); vfw.Location = new Point(WindowLoc.Left, WindowLoc.Top); vfw.Size = new Size(WindowLoc.Width, WindowLoc.Height); vfw.Flicker(); } Image result = GDI32.Grab(SnapRegion); if (VfwWasVisible) { vfw.Visible = true; // Reshow viewfinder if appropriate } this.Visible = true; // Show self again this.Focus(); // Return focus to the main form DebugLog.Log("Took snap"); return(result); } catch (Exception ex) { DebugLog.Log(ex.Message); return(null); } }