CSPspEmu.Gui.Winforms.GameListComponent.textBox1_KeyDown C# (CSharp) Method

textBox1_KeyDown() private method

private textBox1_KeyDown ( object sender, KeyEventArgs e ) : void
sender object
e KeyEventArgs
return void
        private void textBox1_KeyDown(object sender, KeyEventArgs e)
        {
            //Console.WriteLine("KeyDown: {0}", e);
            int SelectedIndex = GameListView.SelectedIndex;
            switch (e.KeyCode)
            {
                case Keys.Up:
                case Keys.Down:
                case Keys.Return:
                    e.Handled = true;
                    e.SuppressKeyPress = true;
                    switch (e.KeyCode)
                    {
                        case Keys.Up: SelectedIndex--; break;
                        case Keys.Down: SelectedIndex++; break;
                    }
                break;
            }
            GameListView.FullRowSelect = true;
            GameListView.SelectedIndex = MathUtils.Clamp(SelectedIndex, 0, GameListView.Items.Count - 1);
            if (e.KeyCode == Keys.Return)
            {
                SelectSelectedItem();
            }
        }