private async void btSaveScreenshot_Click(object sender, EventArgs e) { if (screenshotSaveDialog.ShowDialog(this) == DialogResult.OK) { var filename = screenshotSaveDialog.FileName; var ext = Path.GetExtension(filename)?.ToLowerInvariant(); switch (ext) { case ".bmp": await VideoCapture1.Frame_SaveAsync(filename, VFImageFormat.BMP, 0); break; case ".jpg": await VideoCapture1.Frame_SaveAsync(filename, VFImageFormat.JPEG, 85); break; case ".gif": await VideoCapture1.Frame_SaveAsync(filename, VFImageFormat.GIF, 0); break; case ".png": await VideoCapture1.Frame_SaveAsync(filename, VFImageFormat.PNG, 0); break; case ".tiff": await VideoCapture1.Frame_SaveAsync(filename, VFImageFormat.TIFF, 0); break; } } }