Exemplo n.º 1
0
        public override void Prepare()
        {
            base.Prepare();

            if (Config != null)
            {
                AreaManager.WindowCaptureMode |= Config.ForceWindowCapture;
                AreaManager.IncludeControls   |= Config.IncludeControls;

                if (OneClickMode || AreaManager.WindowCaptureMode)
                {
                    IntPtr handle = Handle;

                    TaskEx.Run(() =>
                    {
                        WindowsRectangleList wla = new WindowsRectangleList();
                        wla.IgnoreHandle         = handle;
                        wla.IncludeChildWindows  = AreaManager.IncludeControls;
                        AreaManager.Windows      = wla.GetWindowsRectangleList();
                    });
                }
            }

            if (Config.UseCustomInfoText || ScreenColorPickerMode)
            {
                bmpSurfaceImage = new Bitmap(SurfaceImage);
            }
        }
Exemplo n.º 2
0
        public override void Prepare()
        {
            base.Prepare();

            if (Config != null)
            {
                ShapeManager = new ShapeManager(this);
                ShapeManager.WindowCaptureMode = Config.DetectWindows;
                ShapeManager.IncludeControls   = Config.DetectControls;

                if (Mode == RectangleRegionMode.Annotation)
                {
                    ShapeManager.CurrentShapeTypeChanged += ShapeManager_CurrentShapeTypeChanged;
                }

                if (Mode == RectangleRegionMode.OneClick || ShapeManager.WindowCaptureMode)
                {
                    IntPtr handle = Handle;

                    TaskEx.Run(() =>
                    {
                        WindowsRectangleList wla = new WindowsRectangleList();
                        wla.IgnoreHandle         = handle;
                        wla.IncludeChildWindows  = ShapeManager.IncludeControls;
                        ShapeManager.Windows     = wla.GetWindowInfoListAsync(5000);
                    });
                }

                if (Config.UseCustomInfoText || Mode == RectangleRegionMode.ScreenColorPicker)
                {
                    bmpBackgroundImage = new Bitmap(backgroundImage);
                }
            }
        }
Exemplo n.º 3
0
        public override void Prepare()
        {
            base.Prepare();

            if (Config != null)
            {
                AreaManager.WindowCaptureMode |= Config.ForceWindowCapture;
                AreaManager.IncludeControls   |= Config.IncludeControls;

                if (AreaManager.WindowCaptureMode)
                {
                    IntPtr handle = Handle;

                    TaskEx.Run(() =>
                    {
                        WindowsRectangleList wla = new WindowsRectangleList();
                        wla.IgnoreHandle         = handle;
                        wla.IncludeChildWindows  = AreaManager.IncludeControls;
                        AreaManager.Windows      = wla.GetWindowsRectangleList();
                    });
                }
            }
        }
Exemplo n.º 4
0
        // Must be called before show form
        public void Prepare(Image img)
        {
            Image = img;

            if (IsEditorMode)
            {
                Rectangle rect = CaptureHelpers.GetActiveScreenBounds0Based();

                if (Image.Width > rect.Width || Image.Height > rect.Height)
                {
                    rect = ScreenRectangle0Based;
                }

                ImageRectangle = new Rectangle(rect.X + rect.Width / 2 - Image.Width / 2, rect.Y + rect.Height / 2 - Image.Height / 2, Image.Width, Image.Height);

                using (Image background = ImageHelpers.DrawCheckers(ScreenRectangle0Based.Width, ScreenRectangle0Based.Height))
                    using (Graphics g = Graphics.FromImage(background))
                    {
                        g.DrawImage(Image, ImageRectangle);

                        backgroundBrush = new TextureBrush(background)
                        {
                            WrapMode = WrapMode.Clamp
                        };
                    }
            }
            else if (Config.UseDimming)
            {
                using (Bitmap darkBackground = (Bitmap)Image.Clone())
                    using (Graphics g = Graphics.FromImage(darkBackground))
                        using (Brush brush = new SolidBrush(Color.FromArgb(30, Color.Black)))
                        {
                            g.FillRectangle(brush, 0, 0, darkBackground.Width, darkBackground.Height);

                            backgroundBrush = new TextureBrush(darkBackground)
                            {
                                WrapMode = WrapMode.Clamp
                            };
                        }

                backgroundHighlightBrush = new TextureBrush(Image)
                {
                    WrapMode = WrapMode.Clamp
                };
            }
            else
            {
                backgroundBrush = new TextureBrush(Image)
                {
                    WrapMode = WrapMode.Clamp
                };
            }

            ShapeManager = new ShapeManager(this);
            ShapeManager.WindowCaptureMode = Config.DetectWindows;
            ShapeManager.IncludeControls   = Config.DetectControls;

            if (Mode == RegionCaptureMode.OneClick || ShapeManager.WindowCaptureMode)
            {
                IntPtr handle = Handle;

                TaskEx.Run(() =>
                {
                    WindowsRectangleList wla = new WindowsRectangleList();
                    wla.IgnoreHandle         = handle;
                    wla.IncludeChildWindows  = ShapeManager.IncludeControls;
                    ShapeManager.Windows     = wla.GetWindowInfoListAsync(5000);
                });
            }

            if (Config.UseCustomInfoText || Mode == RegionCaptureMode.ScreenColorPicker)
            {
                bmpBackgroundImage = new Bitmap(Image);
            }
        }
Exemplo n.º 5
0
        public override void Prepare()
        {
            base.Prepare();

            if (Config != null)
            {
                AreaManager.WindowCaptureMode |= Config.ForceWindowCapture;
                AreaManager.IncludeControls |= Config.IncludeControls;

                if (OneClickMode || AreaManager.WindowCaptureMode)
                {
                    IntPtr handle = Handle;

                    TaskEx.Run(() =>
                    {
                        WindowsRectangleList wla = new WindowsRectangleList();
                        wla.IgnoreHandle = handle;
                        wla.IncludeChildWindows = AreaManager.IncludeControls;
                        AreaManager.Windows = wla.GetWindowsRectangleList();
                    });
                }
            }

            if (Config.UseCustomInfoText || ScreenColorPickerMode)
            {
                bmpSurfaceImage = new Bitmap(SurfaceImage);
            }
        }
Exemplo n.º 6
0
        public override void Prepare()
        {
            base.Prepare();

            if (Config != null)
            {
                ShapeManager = new ShapeManager(this);
                ShapeManager.WindowCaptureMode = Config.DetectWindows;
                ShapeManager.IncludeControls = Config.DetectControls;

                if (Mode == RectangleRegionMode.Annotation)
                {
                    ShapeManager.CurrentShapeTypeChanged += ShapeManager_CurrentShapeTypeChanged;
                }

                if (Mode == RectangleRegionMode.OneClick || ShapeManager.WindowCaptureMode)
                {
                    IntPtr handle = Handle;

                    TaskEx.Run(() =>
                    {
                        WindowsRectangleList wla = new WindowsRectangleList();
                        wla.IgnoreHandle = handle;
                        wla.IncludeChildWindows = ShapeManager.IncludeControls;
                        ShapeManager.Windows = wla.GetWindowInfoListAsync(5000);
                    });
                }

                if (Config.UseCustomInfoText || Mode == RectangleRegionMode.ScreenColorPicker)
                {
                    bmpBackgroundImage = new Bitmap(backgroundImage);
                }
            }
        }
Exemplo n.º 7
0
        // Must be called before show form
        public void Prepare(Image img)
        {
            Image = img;

            if (Mode == RegionCaptureMode.Editor)
            {
                Rectangle rect = CaptureHelpers.GetActiveScreenBounds0Based();

                if (Image.Width > rect.Width || Image.Height > rect.Height)
                {
                    rect = ScreenRectangle0Based;
                }

                ImageRectangle = new Rectangle(rect.X + rect.Width / 2 - Image.Width / 2, rect.Y + rect.Height / 2 - Image.Height / 2, Image.Width, Image.Height);

                using (Image background = ImageHelpers.DrawCheckers(ScreenRectangle0Based.Width, ScreenRectangle0Based.Height))
                using (Graphics g = Graphics.FromImage(background))
                {
                    g.DrawImage(Image, ImageRectangle);

                    backgroundBrush = new TextureBrush(background) { WrapMode = WrapMode.Clamp };
                }
            }
            else if (Config.UseDimming)
            {
                using (Bitmap darkBackground = (Bitmap)Image.Clone())
                using (Graphics g = Graphics.FromImage(darkBackground))
                using (Brush brush = new SolidBrush(Color.FromArgb(30, Color.Black)))
                {
                    g.FillRectangle(brush, 0, 0, darkBackground.Width, darkBackground.Height);

                    backgroundBrush = new TextureBrush(darkBackground) { WrapMode = WrapMode.Clamp };
                }

                backgroundHighlightBrush = new TextureBrush(Image) { WrapMode = WrapMode.Clamp };
            }
            else
            {
                backgroundBrush = new TextureBrush(Image) { WrapMode = WrapMode.Clamp };
            }

            ShapeManager = new ShapeManager(this);
            ShapeManager.WindowCaptureMode = Config.DetectWindows;
            ShapeManager.IncludeControls = Config.DetectControls;

            if (Mode == RegionCaptureMode.OneClick || ShapeManager.WindowCaptureMode)
            {
                IntPtr handle = Handle;

                TaskEx.Run(() =>
                {
                    WindowsRectangleList wla = new WindowsRectangleList();
                    wla.IgnoreHandle = handle;
                    wla.IncludeChildWindows = ShapeManager.IncludeControls;
                    ShapeManager.Windows = wla.GetWindowInfoListAsync(5000);
                });
            }

            if (Config.UseCustomInfoText || Mode == RegionCaptureMode.ScreenColorPicker)
            {
                bmpBackgroundImage = new Bitmap(Image);
            }
        }