Exemplo n.º 1
0
        void CaptureFormKeyDown(object sender, KeyEventArgs e)
        {
            // Check fixmode
            if (e.KeyCode == Keys.ShiftKey)
            {
                if (fixMode == FixMode.None)
                {
                    fixMode = FixMode.Initiated;
                    return;
                }
            }
            if (e.KeyCode == Keys.Escape)
            {
                DialogResult = DialogResult.Cancel;
            }
            else if (e.KeyCode == Keys.M)
            {
                // Toggle mouse cursor
                capture.CursorVisible = !capture.CursorVisible;
                pictureBox.Invalidate();
            }
            else if (e.KeyCode == Keys.V && conf.isExperimentalFeatureEnabled("Video"))
            {
                capture.CaptureDetails.CaptureMode = CaptureMode.Video;
                pictureBox.Invalidate();
            }
            else if (e.KeyCode == Keys.Space)
            {
                switch (captureMode)
                {
                case CaptureMode.Region:
                    captureMode = CaptureMode.Window;
                    break;

                case CaptureMode.Window:
                    captureMode = CaptureMode.Region;
                    break;
                }
                pictureBox.Invalidate();
                selectedCaptureWindow = null;
                PictureBoxMouseMove(this, new MouseEventArgs(MouseButtons.None, 0, Cursor.Position.X, Cursor.Position.Y, 0));
            }
            else if (e.KeyCode == Keys.Return && captureMode == CaptureMode.Window)
            {
                DialogResult = DialogResult.OK;
            }
        }
Exemplo n.º 2
0
 public virtual void ShowContextMenu(MouseEventArgs e, Surface surface)
 {
     if (conf.isExperimentalFeatureEnabled("Contextmenu"))
     {
         bool hasMenu = false;
         foreach (DrawableContainer container in this)
         {
             if (container.hasContextMenu)
             {
                 hasMenu = true;
                 break;
             }
         }
         if (hasMenu)
         {
             ContextMenuStrip menu = new ContextMenuStrip();
             AddContextMenuItems(menu, surface);
             if (menu.Items.Count > 0)
             {
                 menu.Show(surface, e.Location);
             }
         }
     }
 }