示例#1
0
        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);
        }
示例#2
0
        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();
        }
示例#3
0
文件: MainForm.cs 项目: radtek/Ocr
        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;
        }