コード例 #1
0
        public static void RegionCapture(RegionCaptureMode mode, bool creatClip = false)
        {
            using (RegionCaptureForm regionCapture = new RegionCaptureForm(ScreenHelper.GetScreenBounds(), mode))
            {
                regionCapture.ShowDialog();

                LastRegionResult?.Dispose();
                LastRegionResult = regionCapture.GetRsult();


                if (LastRegionResult.Result == RegionResult.Close)
                {
                    return;
                }

                if (LastRegionResult.Result == RegionResult.Color)
                {
                    if (SettingsManager.RegionCaptureSettings.Auto_Copy_Color)
                    {
                        ClipboardHelper.FormatCopyColor(SettingsManager.MiscSettings.Default_Color_Format, LastRegionResult.Color);
                    }
                    return;
                }

                if (SettingsManager.RegionCaptureSettings.Auto_Copy_Image)
                {
                    ClipboardHelper.CopyImage(LastRegionResult.Image);
                }

                string path = string.Empty;

                if (InternalSettings.Save_Images_To_Disk)
                {
                    path = PathHelper.GetNewImageFileName();
                }

                if (creatClip)
                {
                    ClipOptions ops = new ClipOptions(ScreenHelper.GetRectangle0Based(LastRegionResult.Region).Location);
                    ops.FilePath = path;
                    ClipManager.CreateClip(LastRegionResult.Image, ops);
                }

                if (InternalSettings.Save_Images_To_Disk)
                {
                    Save(path, LastRegionResult.Image);
                }

                if (LastRegionResult.Image != null)
                {
                    LastRegionResult.Image.Dispose();
                }
            }
        }
コード例 #2
0
        private void FormKeyDown(object sender, KeyEventArgs e)
        {
            e.Handled = true;
            switch (e.KeyData)
            {
            case (Keys.Z | Keys.Shift | Keys.Control):
            case (Keys.Y | Keys.Control):
                Redo();
                break;

            case (Keys.Z | Keys.Control):
                Undo();
                break;

            case (Keys.C | Keys.Control):
                CopyImage();
                break;

            case (Keys.T | Keys.Control):
                OCR_Image();
                break;

            case (Keys.R | Keys.Control):
                ToggleResize();
                break;

            case (Keys.S | Keys.Control):
                AskSaveImage();
                break;

            case Keys.Escape:
                ClipManager.DestroyClip(ClipName);
                break;

            case Keys.Tab:
                WindowState = FormWindowState.Minimized;
                break;
            }
        }
コード例 #3
0
 private void DestroyAllClips_Click(object sender, EventArgs e)
 {
     ClipManager.DestroyAllClips();
 }
コード例 #4
0
 private void Destroy_Click(object sender, EventArgs e)
 {
     ClipManager.DestroyClip(ClipName);
 }