コード例 #1
0
ファイル: MainForm.cs プロジェクト: sakpung/webstudy
        // 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();
            }
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: sakpung/webstudy
        // *********
        // 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;
        }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: sakpung/webstudy
        // 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;
            }
        }
コード例 #4
0
ファイル: MainForm.cs プロジェクト: sakpung/webstudy
        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();
            }
        }
コード例 #5
0
ファイル: MainForm.cs プロジェクト: sakpung/webstudy
        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;
            }
        }