Esempio n. 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();
                }
            }
        }
Esempio n. 2
0
        public static bool GetRegionResultColor(out COLOR color)
        {
            using (RegionCaptureForm regionCapture = new RegionCaptureForm(ScreenHelper.GetScreenBounds(), RegionCaptureMode.ColorPicker))
            {
                regionCapture.ShowDialog();
                LastRegionResult?.Dispose();
                LastRegionResult = regionCapture.GetRsult();

                if (LastRegionResult.Result == RegionResult.Close)
                {
                    color = Color.Empty;
                    return(false);
                }

                color = LastRegionResult.Color;
                return(true);
            }
        }
Esempio n. 3
0
        public static bool GetRegionResultImage(out Image image)
        {
            using (RegionCaptureForm regionCapture = new RegionCaptureForm(ScreenHelper.GetScreenBounds(), RegionCaptureMode.Default))
            {
                regionCapture.ShowDialog();
                LastRegionResult?.Dispose();
                LastRegionResult = regionCapture.GetRsult();

                if (LastRegionResult.Result == RegionResult.Close || LastRegionResult.Image == null)
                {
                    image = null;
                    return(false);
                }

                image = LastRegionResult.Image.CloneSafe();
                return(true);
            }
        }