Example #1
0
        private void UpdatePreview(ScreenCapture screenCapture)
        {
            try
            {
                if (comboBoxScreenComponent.SelectedIndex == 0)
                {
                    pictureBoxPreview.Image = screenCapture.GetActiveWindowBitmap();
                }
                else
                {
                    System.Windows.Forms.Screen screen = GetScreenByIndex(comboBoxScreenComponent.SelectedIndex);

                    pictureBoxPreview.Image = screen != null
                        ? screenCapture.GetScreenBitmap(
                        screen.Bounds.X,
                        screen.Bounds.Y,
                        screen.Bounds.Width,
                        screen.Bounds.Height,
                        (int)numericUpDownResolutionRatio.Value,
                        checkBoxMouse.Checked
                        )
                        : null;
                }

                System.GC.Collect();
            }
            catch (Exception ex)
            {
                Log.Write("FormScreen::UpdatePreview", ex);
            }
        }
Example #2
0
        private void UpdatePreviewImage(ScreenCapture screenCapture)
        {
            try
            {
                if (checkBoxActive.Checked)
                {
                    if (comboBoxScreenComponent.SelectedIndex == 0)
                    {
                        pictureBoxPreview.Image = screenCapture.GetActiveWindowBitmap();
                    }
                    else
                    {
                        System.Windows.Forms.Screen screen = GetScreenByIndex(comboBoxScreenComponent.SelectedIndex);

                        pictureBoxPreview.Image = screen != null
                            ? screenCapture.GetScreenBitmap(
                            screen.Bounds.X,
                            screen.Bounds.Y,
                            screen.Bounds.Width,
                            screen.Bounds.Height,
                            (int)numericUpDownResolutionRatio.Value,
                            checkBoxMouse.Checked
                            )
                            : null;
                    }

                    UpdatePreviewMacro();
                }
                else
                {
                    pictureBoxPreview.Image = null;

                    textBoxMacroPreview.ForeColor = System.Drawing.Color.White;
                    textBoxMacroPreview.BackColor = System.Drawing.Color.Black;
                    textBoxMacroPreview.Text      = "[Active option is off. No screenshots of this screen will be taken during a running screen capture session]";
                }
            }
            catch (Exception ex)
            {
                Log.WriteExceptionMessage("FormScreen::UpdatePreview", ex);
            }
        }
Example #3
0
        private void UpdatePreview()
        {
            if (comboBoxScreenComponent.SelectedIndex == 0) // Active Window
            {
                pictureBoxScreenPreview.Image = ScreenCapture.GetActiveWindowBitmap();
            }
            else // Screen 1, 2, 3, etc.
            {
                System.Windows.Forms.Screen screen = ScreenDictionary[comboBoxScreenComponent.SelectedIndex];

                pictureBoxScreenPreview.Image = ScreenCapture.GetScreenBitmap(
                    screen.Bounds.X,
                    screen.Bounds.Y,
                    screen.Bounds.Width,
                    screen.Bounds.Height,
                    (int)numericUpDownScreenResolutionRatio.Value,
                    checkBoxScreenMouse.Checked
                    );
            }
        }
Example #4
0
        private void UpdatePreview()
        {
            if (comboBoxScreenComponent.SelectedIndex == 0)
            {
                pictureBoxPreview.Image = ScreenCapture.GetActiveWindowBitmap();
            }
            else
            {
                System.Windows.Forms.Screen screen = GetScreenByIndex(comboBoxScreenComponent.SelectedIndex);

                pictureBoxPreview.Image = screen != null
                    ? ScreenCapture.GetScreenBitmap(
                    screen.Bounds.X,
                    screen.Bounds.Y,
                    screen.Bounds.Width,
                    screen.Bounds.Height,
                    (int)numericUpDownResolutionRatio.Value,
                    checkBoxMouse.Checked
                    )
                    : null;
            }
        }
Example #5
0
        private void UpdatePreviewImage(ScreenCapture screenCapture)
        {
            try
            {
                // The mouse pointer gets really weird if we go under 100 resolution ratio
                // so disable the mouse checkbox control to indicate we can't show the mouse pointer.
                if (numericUpDownResolutionRatio.Value == 100)
                {
                    checkBoxMouse.Enabled = true;
                }
                else
                {
                    checkBoxMouse.Enabled = false;
                }

                if (checkBoxAutoAdapt.Checked)
                {
                    labelScreenSource.Enabled    = false;
                    labelScreenComponent.Enabled = false;

                    comboBoxScreenSource.Enabled    = false;
                    comboBoxScreenComponent.Enabled = false;

                    labelX.Enabled      = false;
                    labelY.Enabled      = false;
                    labelWidth.Enabled  = false;
                    labelHeight.Enabled = false;

                    numericUpDownX.Enabled      = false;
                    numericUpDownY.Enabled      = false;
                    numericUpDownWidth.Enabled  = false;
                    numericUpDownHeight.Enabled = false;
                }
                else
                {
                    labelScreenSource.Enabled    = true;
                    labelScreenComponent.Enabled = true;

                    comboBoxScreenSource.Enabled    = true;
                    comboBoxScreenComponent.Enabled = true;

                    labelX.Enabled      = true;
                    labelY.Enabled      = true;
                    labelWidth.Enabled  = true;
                    labelHeight.Enabled = true;

                    numericUpDownX.Enabled      = true;
                    numericUpDownY.Enabled      = true;
                    numericUpDownWidth.Enabled  = true;
                    numericUpDownHeight.Enabled = true;
                }

                // The Source is "Auto Screen Capture" and the Component is "Active Window".
                if (comboBoxScreenSource.SelectedIndex == 0 && comboBoxScreenComponent.SelectedIndex == 0)
                {
                    labelX.Enabled      = false;
                    labelY.Enabled      = false;
                    labelWidth.Enabled  = false;
                    labelHeight.Enabled = false;

                    numericUpDownX.Enabled      = false;
                    numericUpDownY.Enabled      = false;
                    numericUpDownWidth.Enabled  = false;
                    numericUpDownHeight.Enabled = false;
                }

                pictureBoxPreview.Image = null;

                if (checkBoxEnable.Checked)
                {
                    // This is for when the option "Automatically adapt to display setup" is enabled.
                    // We need to show the position and size based on what Windows provides.
                    if (checkBoxAutoAdapt.Checked)
                    {
                        int x      = 0;
                        int y      = 0;
                        int width  = 0;
                        int height = 0;

                        for (int i = 0; i < System.Windows.Forms.Screen.AllScreens.Length; i++)
                        {
                            System.Windows.Forms.Screen screenFromWindows = System.Windows.Forms.Screen.AllScreens[i];
                            ScreenCapture.DeviceOptions deviceResolution  = _screenCapture.GetDevice(screenFromWindows);

                            if (i == _autoAdaptIndex)
                            {
                                x      = screenFromWindows.Bounds.X;
                                y      = screenFromWindows.Bounds.Y;
                                width  = deviceResolution.width;
                                height = deviceResolution.height;

                                break;
                            }
                        }

                        pictureBoxPreview.Image = screenCapture.GetScreenBitmap(
                            comboBoxScreenSource.SelectedIndex,
                            comboBoxScreenComponent.SelectedIndex,
                            comboBoxScreenCaptureMethod.SelectedIndex,
                            x,
                            y,
                            width,
                            height,
                            (int)numericUpDownResolutionRatio.Value,
                            checkBoxMouse.Checked
                            );
                    }
                    else
                    {
                        // The Source is "Auto Screen Capture" and the Component is "Active Window".
                        if (comboBoxScreenSource.SelectedIndex == 0 && comboBoxScreenComponent.SelectedIndex == 0)
                        {
                            pictureBoxPreview.Image = screenCapture.GetActiveWindowBitmap((int)numericUpDownResolutionRatio.Value, checkBoxMouse.Checked);
                        }
                        else
                        {
                            pictureBoxPreview.Image = screenCapture.GetScreenBitmap(
                                comboBoxScreenSource.SelectedIndex,
                                comboBoxScreenComponent.SelectedIndex,
                                comboBoxScreenCaptureMethod.SelectedIndex,
                                (int)numericUpDownX.Value,
                                (int)numericUpDownY.Value,
                                (int)numericUpDownWidth.Value,
                                (int)numericUpDownHeight.Value,
                                (int)numericUpDownResolutionRatio.Value,
                                checkBoxMouse.Checked
                                );
                        }
                    }

                    UpdatePreviewMacro();
                }
                else
                {
                    textBoxMacroPreview.ForeColor = System.Drawing.Color.White;
                    textBoxMacroPreview.BackColor = System.Drawing.Color.Black;
                    textBoxMacroPreview.Text      = "[Enable option is off. No screenshots of this screen will be taken during a running screen capture session]";
                }
            }
            catch (Exception ex)
            {
                _log.WriteExceptionMessage("FormScreen::UpdatePreviewImage", ex);
            }
        }
Example #6
0
        private void UpdatePreviewImage(ScreenCapture screenCapture)
        {
            try
            {
                // The Source is "Auto Screen Capture" and the Component is "Active Window".
                if (comboBoxScreenSource.SelectedIndex == 0 && comboBoxScreenComponent.SelectedIndex == 0)
                {
                    labelX.Enabled      = false;
                    labelY.Enabled      = false;
                    labelWidth.Enabled  = false;
                    labelHeight.Enabled = false;

                    numericUpDownX.Enabled      = false;
                    numericUpDownY.Enabled      = false;
                    numericUpDownWidth.Enabled  = false;
                    numericUpDownHeight.Enabled = false;
                }
                else
                {
                    labelX.Enabled      = true;
                    labelY.Enabled      = true;
                    labelWidth.Enabled  = true;
                    labelHeight.Enabled = true;

                    numericUpDownX.Enabled      = true;
                    numericUpDownY.Enabled      = true;
                    numericUpDownWidth.Enabled  = true;
                    numericUpDownHeight.Enabled = true;
                }

                if (checkBoxActive.Checked)
                {
                    // The Source is "Auto Screen Capture" and the Component is "Active Window".
                    if (comboBoxScreenSource.SelectedIndex == 0 && comboBoxScreenComponent.SelectedIndex == 0)
                    {
                        pictureBoxPreview.Image = screenCapture.GetActiveWindowBitmap();
                    }
                    else
                    {
                        pictureBoxPreview.Image = screenCapture.GetScreenBitmap(
                            comboBoxScreenSource.SelectedIndex,
                            comboBoxScreenComponent.SelectedIndex,
                            (int)numericUpDownX.Value,
                            (int)numericUpDownY.Value,
                            (int)numericUpDownWidth.Value,
                            (int)numericUpDownHeight.Value,
                            checkBoxMouse.Checked
                            );
                    }

                    UpdatePreviewMacro();
                }
                else
                {
                    pictureBoxPreview.Image = null;

                    textBoxMacroPreview.ForeColor = System.Drawing.Color.White;
                    textBoxMacroPreview.BackColor = System.Drawing.Color.Black;
                    textBoxMacroPreview.Text      = "[Active option is off. No screenshots of this screen will be taken during a running screen capture session]";
                }
            }
            catch (Exception ex)
            {
                _log.WriteExceptionMessage("FormScreen::UpdatePreviewImage", ex);
            }
        }