private async void BtnClipBoard_Click(object sender, EventArgs e) { cropRect.Visible = false; await DelayAction(); Clipboard.SetImage(AssistOperation.CaptureResult(this, cropRect)); cropRect.Visible = true; if (FrmTray.options.closeafterclipboard) { this.Close(); } }
private async void BtnUpload_Click(object sender, EventArgs e) { cropRect.Visible = false; await DelayAction(); Image img = AssistOperation.CaptureResult(this, cropRect); cropRect.Visible = true; this.Close(); FrmUploader upload = new FrmUploader(img); upload.Show(); }
private async void BtnSaveToFile_Click(object sender, EventArgs e) { cropRect.Visible = false; await DelayAction(); Image CapturedImage = AssistOperation.CaptureResult(this, cropRect); SaveFileDialog sfd = new SaveFileDialog(); sfd.Title = "Save an Image File"; sfd.RestoreDirectory = true; sfd.Filter = "PNG Image|*.png|Jpeg Image|*.jpg|Bitmap Image|*.bmp"; sfd.FileName = string.Format("screenshot {0}", DateTime.Now.ToString("HH-dd-MM")); ImageFormat imgformat = ImageFormat.Png; if (sfd.ShowDialog() == DialogResult.OK) { string ext = System.IO.Path.GetExtension(sfd.FileName).ToLower(); switch (ext.ToLower()) { case ".jpg": imgformat = ImageFormat.Jpeg; break; case ".png": imgformat = ImageFormat.Png; break; case ".bmp": imgformat = ImageFormat.Bmp; break; } CapturedImage.Save(sfd.FileName, imgformat); } CapturedImage.Dispose(); cropRect.Visible = true; if (FrmTray.options.closeafterclipboard) { this.Close(); } }