Пример #1
0
        public static bool SelectRegion(out Rectangle rect, TaskSettings taskSettings)
        {
            using (RectangleRegion surface = new RectangleRegion())
            {
                surface.Config                    = taskSettings.CaptureSettings.SurfaceOptions;
                surface.Config.ShowTips           = false;
                surface.Config.QuickCrop          = true;
                surface.Config.ForceWindowCapture = true;
                surface.Prepare();
                surface.ShowDialog();

                if (surface.Result == SurfaceResult.Region)
                {
                    if (surface.AreaManager.IsCurrentAreaValid)
                    {
                        rect = CaptureHelpers.ClientToScreen(surface.AreaManager.CurrentArea);
                        return(true);
                    }
                }
                else if (surface.Result == SurfaceResult.Fullscreen)
                {
                    rect = CaptureHelpers.GetScreenBounds();
                    return(true);
                }
                else if (surface.Result == SurfaceResult.Monitor)
                {
                    Screen[] screens = Screen.AllScreens;

                    if (surface.MonitorIndex < screens.Length)
                    {
                        Screen screen = screens[surface.MonitorIndex];
                        rect = screen.Bounds;
                        return(true);
                    }
                }
                else if (surface.Result == SurfaceResult.ActiveMonitor)
                {
                    rect = CaptureHelpers.GetActiveScreenBounds();
                    return(true);
                }
            }

            rect = Rectangle.Empty;
            return(false);
        }
Пример #2
0
        public static PointInfo SelectPointColor()
        {
            using (RectangleRegion surface = new RectangleRegion())
            {
                surface.OneClickMode = true;
                surface.Prepare();
                surface.ShowDialog();

                if (surface.Result == SurfaceResult.Region)
                {
                    PointInfo pointInfo = new PointInfo();
                    pointInfo.Position = CaptureHelpers.ClientToScreen(surface.CurrentPosition);
                    pointInfo.Color    = surface.CurrentColor;
                    return(pointInfo);
                }
            }

            return(null);
        }
Пример #3
0
        public static PointInfo SelectPointColor()
        {
            using (RectangleRegion surface = new RectangleRegion())
            {
                surface.ScreenColorPickerMode = true;
                surface.Config.UseDimming     = false;
                surface.Config.ShowInfo       = true;
                surface.Config.ShowMagnifier  = true;
                surface.Config.ShowTips       = false;
                surface.Prepare();
                surface.ShowDialog();

                if (surface.Result == SurfaceResult.Region)
                {
                    PointInfo pointInfo = new PointInfo();
                    pointInfo.Position = surface.CurrentPosition;
                    pointInfo.Color    = surface.CurrentColor;
                    return(pointInfo);
                }
            }

            return(null);
        }
Пример #4
0
        public static bool SelectRegion(out Rectangle rect, TaskSettings taskSettings)
        {
            using (RectangleRegion surface = new RectangleRegion())
            {
                surface.Config = taskSettings.CaptureSettings.SurfaceOptions;
                surface.Config.ShowTips = false;
                surface.Config.QuickCrop = true;
                surface.Config.ForceWindowCapture = true;
                surface.Prepare();
                surface.ShowDialog();

                if (surface.Result == SurfaceResult.Region)
                {
                    if (surface.AreaManager.IsCurrentAreaValid)
                    {
                        rect = CaptureHelpers.ClientToScreen(surface.AreaManager.CurrentArea);
                        return true;
                    }
                }
                else if (surface.Result == SurfaceResult.Fullscreen)
                {
                    rect = CaptureHelpers.GetScreenBounds();
                    return true;
                }
                else if (surface.Result == SurfaceResult.Monitor)
                {
                    Screen[] screens = Screen.AllScreens;

                    if (surface.MonitorIndex < screens.Length)
                    {
                        Screen screen = screens[surface.MonitorIndex];
                        rect = screen.Bounds;
                        return true;
                    }
                }
                else if (surface.Result == SurfaceResult.ActiveMonitor)
                {
                    rect = CaptureHelpers.GetActiveScreenBounds();
                    return true;
                }
            }

            rect = Rectangle.Empty;
            return false;
        }
Пример #5
0
        public static PointInfo SelectPointColor()
        {
            using (RectangleRegion surface = new RectangleRegion())
            {
                surface.ScreenColorPickerMode = true;
                surface.Config.UseDimming = false;
                surface.Config.ShowInfo = true;
                surface.Config.ShowMagnifier = true;
                surface.Config.ShowTips = false;
                surface.Prepare();
                surface.ShowDialog();

                if (surface.Result == SurfaceResult.Region)
                {
                    PointInfo pointInfo = new PointInfo();
                    pointInfo.Position = surface.CurrentPosition;
                    pointInfo.Color = surface.CurrentColor;
                    return pointInfo;
                }
            }

            return null;
        }
Пример #6
0
 public static void OpenRuler()
 {
     using (RectangleRegion surface = new RectangleRegion())
     {
         surface.RulerMode = true;
         surface.Config.ShowTips = false;
         surface.Config.QuickCrop = false;
         surface.Config.ShowInfo = true;
         surface.AreaManager.MinimumSize = 3;
         surface.Prepare();
         surface.ShowDialog();
     }
 }