Example #1
0
        public TakeForm(Image screenImage)
        {
            InitializeComponent();

                        #if DEBUG
            TopMost = false;
                        #endif

            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint, true);
            Size = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);

            action   = TakeScreenAction.Selection;
            srcImage = screenImage;

            var winEnumDelegate = new Helper.EnumDelegate((h, p) =>
            {
                if (!Helper.IsWindowVisible(h))
                {
                    return(true);
                }

                windowsRects.Add(Helper.GetWindowRect(h));
                return(true);
            });

            Helper.EnumDesktopWindows(IntPtr.Zero, winEnumDelegate, IntPtr.Zero);
            Load += (s, e) => Helper.SetForegroundWindow(Handle);
        }
Example #2
0
        public TakeForm(Image screenImage)
        {
            InitializeComponent();

            #if DEBUG
            TopMost = false;
            #endif

            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint, true);
            Size = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);

            action = TakeScreenAction.Selection;
            srcImage = screenImage;

            var winEnumDelegate = new Helper.EnumDelegate((h, p) =>
            {
                if (!Helper.IsWindowVisible(h))
                    return true;

                windowsRects.Add(Helper.GetWindowRect(h));
                return true;
            });

            Helper.EnumDesktopWindows(IntPtr.Zero, winEnumDelegate, IntPtr.Zero);
            Load += (s, e) => Helper.SetForegroundWindow(Handle);
        }
Example #3
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
            {
                return;
            }

            isMouseDown    = true;
            action         = TakeScreenAction.Selection;
            selection      = Rectangle.Empty;
            selectionStart = new Point(e.X, e.Y);
            Invalidate();

            base.OnMouseDown(e);
        }
Example #4
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
                return;

            isMouseDown = true;
            action = TakeScreenAction.Selection;
            selection = Rectangle.Empty;
            selectionStart = new Point(e.X, e.Y);
            Invalidate();

            base.OnMouseDown(e);
        }