Exemple #1
0
        // Edit Menu - Copy
        private void _miEditCopy_Click(object sender, EventArgs e)
        {
            CapturedImageForm capturedImageForm = ActiveCapturedImageForm;

            try
            {
                using (WaitCursor wait = new WaitCursor())
                {
                    RasterClipboard.Copy(
                        this.Handle,
                        capturedImageForm.Viewer.Image,
                        RasterClipboardCopyFlags.Empty |
                        RasterClipboardCopyFlags.Dib |
                        RasterClipboardCopyFlags.Palette |
                        RasterClipboardCopyFlags.Region);
                }
            }
            catch (Exception ex)
            {
                Messager.ShowError(this, ex);
            }
            finally
            {
                UpdateMyControls();
            }
        }
Exemple #2
0
        // *********
        // EDIT MENU
        // *********

        // Edit Menu - Cut
        private void _miEditCut_Click(object sender, EventArgs e)
        {
            _miEditCopy_Click(sender, e);
            CapturedImageForm capturedImageForm = ActiveCapturedImageForm;

            _cutImage = true;
            capturedImageForm.Close();
            _cutImage = false;
        }
Exemple #3
0
        // File Menu - SaveAs
        private void _miFileSaveAs_Click(object sender, EventArgs e)
        {
            ImageFileSaver saver = new ImageFileSaver();

            _isImageSaved = false;

            try
            {
                CapturedImageForm activeForm = ActiveCapturedImageForm;
                saver.Save(this, _codecs, activeForm.Viewer.Image);
                _isImageSaved = true;
            }
            catch (Exception ex)
            {
                Messager.ShowFileSaveError(this, saver.FileName, ex);
                _isImageSaved = false;
            }
        }
Exemple #4
0
        void _engine_CaptureInformation(object sender, ScreenCaptureInformationEventArgs e)
        {
            CapturedImageForm child = new CapturedImageForm();

            _countOfOpenedImages++;
            child.MdiParent    = this;
            child.Viewer.Image = e.Image;
            child.Text         = DemosGlobalization.GetResxString(GetType(), "Resx_CapturedImage") + _countOfOpenedImages;
            child.Show();

            if (_activateAfterCapture)
            {
                this.WindowState = _previousWindowState;
            }

            if (_isBeepOn)
            {
                SystemSounds.Beep.Play();
            }
        }
Exemple #5
0
        private void UpdateMyControls()
        {
            // if we have an image then enable the Save
            CapturedImageForm capturedImageForm = ActiveCapturedImageForm;

            if (capturedImageForm != null)
            {
                _miFileSaveAs.Enabled = true;
                _miEditCopy.Enabled   = true;
                _miEditCut.Enabled    = true;
            }
            else
            {
                _miFileSaveAs.Enabled = false;
                _miEditCopy.Enabled   = false;
                _miEditCut.Enabled    = false;
            }

            _miCaptureActiveWindow.Checked      = false;
            _miCaptureActiveClient.Checked      = false;
            _miCaptureFullScreen.Checked        = false;
            _miCaptureSelectedObject.Checked    = false;
            _miCaptureMenuUnderCursor.Checked   = false;
            _miCaptureSelectedArea.Checked      = false;
            _miCaptureWallpaper.Checked         = false;
            _miCaptureMouseCursor.Checked       = false;
            _miCaptureWindowUnderCursor.Checked = false;

            switch (_captureType)
            {
            case CaptureType.ActiveWindow:
                _miCaptureActiveWindow.Checked = true;
                _miCaptureStopCapture.Enabled  = true;
                break;

            case CaptureType.ActiveClient:
                _miCaptureActiveClient.Checked = true;
                _miCaptureStopCapture.Enabled  = true;
                break;

            case CaptureType.FullScreen:
                _miCaptureFullScreen.Checked  = true;
                _miCaptureStopCapture.Enabled = true;
                break;

            case CaptureType.SelectedObject:
                _miCaptureSelectedObject.Checked = true;
                _miCaptureStopCapture.Enabled    = true;
                break;

            case CaptureType.MenuUnderCursor:
                _miCaptureMenuUnderCursor.Checked = true;
                _miCaptureStopCapture.Enabled     = true;
                break;

            case CaptureType.Area:
                _miCaptureSelectedArea.Checked = true;
                _miCaptureStopCapture.Enabled  = true;
                break;

            case CaptureType.WallPaper:
                _miCaptureWallpaper.Checked   = true;
                _miCaptureStopCapture.Enabled = true;
                break;

            case CaptureType.MouseCursor:
                _miCaptureMouseCursor.Checked = true;
                _miCaptureStopCapture.Enabled = true;
                break;

            case CaptureType.WindowUnderCursor:
                _miCaptureWindowUnderCursor.Checked = true;
                _miCaptureStopCapture.Enabled       = true;
                break;

            default:
                _miCaptureStopCapture.Enabled = false;
                break;
            }
        }