private void CaptureWindow(IntPtr handle, bool autoHideForm = true) { autoHideForm = autoHideForm && handle != this.Handle; Capture(() => { if (NativeMethods.IsIconic(handle)) { NativeMethods.RestoreWindow(handle); } NativeMethods.SetForegroundWindow(handle); Thread.Sleep(250); if (Program.Settings.CaptureTransparent) { return(Screenshot.CaptureWindowTransparent(handle)); } return(Screenshot.CaptureWindow(handle)); }, autoHideForm); }