Пример #1
0
        private void KeyHandler(object sender, KeyEventArgs e)
        {
            e.SuppressKeyPress = true;
            switch (e.KeyCode)
            {
            case Keys.Escape:
                if (!_fullScreen)
                {
                    Close();
                }
                else
                {
                    _fullScreen = false;
                    Resize     -= ViewerResized;
                    DisplayDevice.Default.RestoreResolution();
                    FormBorderStyle     = FormBorderStyle.Sizable;
                    TopMost             = false;
                    WindowState         = _windowState;
                    TabControl1.Visible = true;
                    ViewerBox.Location  = new Point(TabControl1.Width + 1, 0);
                    ViewerBox.Size      = new Size(Width - TabControl1.Width - 17, Height - 36);
                    Resize += ViewerResized;
                    ViewerResized();
                }

                break;

            case Keys.Space:
                _replayController.TogglePlay();
                break;

            case Constants.Decrease:
                if (!(Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)))
                {
                    _replayController.PreviousFrame();
                }
                break;

            case Constants.Increase:
                if (!(Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)))
                {
                    _replayController.NextFrame();
                }
                break;

            case Keys.Oemcomma:
                if (PlayList.SelectedIndex == -1)
                {
                    PlayList.SelectedIndex = PlayList.Items.Count - 1;
                }
                else
                {
                    PlayList.SelectedIndex--;
                }
                break;

            case Keys.OemPeriod:
                if (PlayList.SelectedIndex == PlayList.Items.Count - 1)
                {
                    PlayList.SelectedIndex = -1;
                }
                else
                {
                    PlayList.SelectedIndex++;
                }
                break;

            case Keys.F11:
                FullScreen(null, null);
                break;

            case Keys.F5:
                _replayController.ZoomCtrl.ZoomFill();
                break;

            case Keys.Enter:
                TextBoxKeyPress(e);
                break;

            default:
                e.SuppressKeyPress = false;
                break;
            }
        }