public static bool Snip(SnippingMode mode, out System.Drawing.Image image, out System.Drawing.Rectangle selection) { SnippingTool snippingTool = new SnippingTool(mode, CreateScreenshot()); System.Windows.Forms.Integration.ElementHost.EnableModelessKeyboardInterop(snippingTool); snippingTool.ShowDialog(); image = snippingTool.Image; selection = snippingTool.Selection; return(snippingTool.Result); }
public SnippingTool(SnippingMode mode, System.Drawing.Image image) { ImageSource = new Image(); Mode = mode; Image = image; backgroundColor = ParseColor(Program.Settings.CaptureAreaStyle.Back); borderColor = ParseColor(Program.Settings.CaptureAreaStyle.Border); borderDashed = Program.Settings.CaptureAreaStyle.DashedBorder; Initialize(); }
private void CaptureArea(SnippingMode mode) { this.Visible = false; Image image; Rectangle selection; if (SnippingTool.Snip(mode, out image, out selection) && selection.Width > 0 && selection.Height > 0) { ocrImagePanel.SetImage(image, selection); if (ocrImagePanel.SelectionImage != null && Program.Settings.Clipboard.SaveImageToClipboard) { Clipboard.SetImage(ocrImagePanel.SelectionImage); } } this.Visible = true; }