private void FormDoubleClick(object?sender, EventArgs e) { var tempName = Path.GetTempFileName(); _capture.Pause(); _capture.SaveCurrentFrame(tempName); _capture.Resume(); using var bmp = new Bitmap(tempName); var dialog = _dialogFactory.GetSave(); dialog.Filters = "PNG files|*.png"; dialog.FileName = $"{DateTime.Now:yyyyMMdd-HHmmss}.png"; if (dialog.Show() == DialogResult.OK) { bmp.Save(dialog.FileName, ImageFormat.Png); } bmp?.Dispose(); File.Delete(tempName); }