Exemple #1
0
        private void StartCapture()
        {
            isCapturing     = true;
            btnCapture.Text = Resources.ScrollingCaptureForm_StartCapture_Stop_capture;
            WindowState     = FormWindowState.Minimized;
            firstCapture    = true;

            if (Options.ScrollMethod == ScrollingCaptureScrollMethod.Automatic)
            {
                currentScrollMethod = ScrollingCaptureScrollMethod.SendMessageScroll;
            }
            else
            {
                currentScrollMethod = Options.ScrollMethod;
            }

            detectingScrollMethod = true;
            Clean();
            selectedWindow.Activate();
            captureTimer.Interval = Options.StartDelay;
            captureTimer.Start();
        }
Exemple #2
0
        private void captureTimer_Tick(object sender, EventArgs e)
        {
            if (firstCapture)
            {
                firstCapture          = false;
                captureTimer.Interval = Options.ScrollDelay;

                if (Options.ScrollTopMethodBeforeCapture == ScrollingCaptureScrollTopMethod.All || Options.ScrollTopMethodBeforeCapture == ScrollingCaptureScrollTopMethod.KeyPressHome)
                {
                    InputHelpers.SendKeyPress(VirtualKeyCode.HOME);
                }

                if (Options.ScrollTopMethodBeforeCapture == ScrollingCaptureScrollTopMethod.All || Options.ScrollTopMethodBeforeCapture == ScrollingCaptureScrollTopMethod.SendMessageTop)
                {
                    NativeMethods.SendMessage(selectedWindow.Handle, (int)WindowsMessages.VSCROLL, (int)ScrollBarCommands.SB_TOP, 0);
                }

                if (Options.ScrollTopMethodBeforeCapture != ScrollingCaptureScrollTopMethod.None)
                {
                    return;
                }
            }

            Screenshot screenshot = new Screenshot()
            {
                CaptureCursor = false
            };
            Bitmap bmp = screenshot.CaptureRectangle(selectedRectangle);

            if (bmp != null)
            {
                images.Add(bmp);
            }

            if (Options.ScrollMethod == ScrollingCaptureScrollMethod.Automatic && detectingScrollMethod && images.Count > 1 && IsLastTwoImagesSame())
            {
                if (currentScrollMethod == ScrollingCaptureScrollMethod.SendMessageScroll)
                {
                    currentScrollMethod = ScrollingCaptureScrollMethod.KeyPressPageDown;
                }
                else if (currentScrollMethod == ScrollingCaptureScrollMethod.KeyPressPageDown)
                {
                    currentScrollMethod = ScrollingCaptureScrollMethod.MouseWheel;
                }
                else
                {
                    StopCapture();
                }
            }
            else if (currentScrollCount == Options.MaximumScrollCount || (Options.AutoDetectScrollEnd && IsScrollReachedBottom(selectedWindow.Handle)))
            {
                StopCapture();
            }
            else if (images.Count > 1)
            {
                detectingScrollMethod = false;
            }

            switch (currentScrollMethod)
            {
            case ScrollingCaptureScrollMethod.Automatic:
            case ScrollingCaptureScrollMethod.SendMessageScroll:
                NativeMethods.SendMessage(selectedWindow.Handle, (int)WindowsMessages.VSCROLL, (int)ScrollBarCommands.SB_PAGEDOWN, 0);
                break;

            case ScrollingCaptureScrollMethod.KeyPressPageDown:
                InputHelpers.SendKeyPress(VirtualKeyCode.NEXT);
                break;

            case ScrollingCaptureScrollMethod.MouseWheel:
                InputHelpers.SendMouseWheel(-120);
                break;
            }

            currentScrollCount++;
        }
        private void StartCapture()
        {
            isCapturing = true;
            btnCapture.Text = Resources.ScrollingCaptureForm_StartCapture_Stop_capture;
            WindowState = FormWindowState.Minimized;
            firstCapture = true;

            if (Options.ScrollMethod == ScrollingCaptureScrollMethod.Automatic)
            {
                currentScrollMethod = ScrollingCaptureScrollMethod.SendMessageScroll;
            }
            else
            {
                currentScrollMethod = Options.ScrollMethod;
            }

            detectingScrollMethod = true;
            Clean();
            selectedWindow.Activate();
            captureTimer.Interval = Options.StartDelay;
            captureTimer.Start();
        }
        private void captureTimer_Tick(object sender, EventArgs e)
        {
            if (firstCapture)
            {
                firstCapture = false;
                captureTimer.Interval = Options.ScrollDelay;

                if (Options.ScrollTopMethodBeforeCapture == ScrollingCaptureScrollTopMethod.All || Options.ScrollTopMethodBeforeCapture == ScrollingCaptureScrollTopMethod.KeyPressHome)
                {
                    InputHelpers.SendKeyPress(VirtualKeyCode.HOME);
                }

                if (Options.ScrollTopMethodBeforeCapture == ScrollingCaptureScrollTopMethod.All || Options.ScrollTopMethodBeforeCapture == ScrollingCaptureScrollTopMethod.SendMessageTop)
                {
                    NativeMethods.SendMessage(selectedWindow.Handle, (int)WindowsMessages.VSCROLL, (int)ScrollBarCommands.SB_TOP, 0);
                }

                if (Options.ScrollTopMethodBeforeCapture != ScrollingCaptureScrollTopMethod.None)
                {
                    return;
                }
            }

            Screenshot.CaptureCursor = false;
            Image image = Screenshot.CaptureRectangle(selectedRectangle);

            if (image != null)
            {
                images.Add(image);
            }

            if (Options.ScrollMethod == ScrollingCaptureScrollMethod.Automatic && detectingScrollMethod && images.Count > 1 && IsLastTwoImagesSame())
            {
                if (currentScrollMethod == ScrollingCaptureScrollMethod.SendMessageScroll)
                {
                    currentScrollMethod = ScrollingCaptureScrollMethod.KeyPressPageDown;
                }
                else if (currentScrollMethod == ScrollingCaptureScrollMethod.KeyPressPageDown)
                {
                    currentScrollMethod = ScrollingCaptureScrollMethod.MouseWheel;
                }
                else
                {
                    StopCapture();
                }
            }
            else if (currentScrollCount == Options.MaximumScrollCount || (Options.AutoDetectScrollEnd && IsScrollReachedBottom(selectedWindow.Handle)))
            {
                StopCapture();
            }
            else if (images.Count > 1)
            {
                detectingScrollMethod = false;
            }

            switch (currentScrollMethod)
            {
                case ScrollingCaptureScrollMethod.Automatic:
                case ScrollingCaptureScrollMethod.SendMessageScroll:
                    NativeMethods.SendMessage(selectedWindow.Handle, (int)WindowsMessages.VSCROLL, (int)ScrollBarCommands.SB_PAGEDOWN, 0);
                    break;
                case ScrollingCaptureScrollMethod.KeyPressPageDown:
                    InputHelpers.SendKeyPress(VirtualKeyCode.NEXT);
                    break;
                case ScrollingCaptureScrollMethod.MouseWheel:
                    InputHelpers.SendMouseWheel(-120);
                    break;
            }

            currentScrollCount++;
        }