Exemplo n.º 1
0
        private void AutoFillListBoxKeyUpHandler(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.Escape:
                HideAutoFillListBox();
                _autoFillHandler.HandleAutoFillFinished();
                break;

            case Keys.Enter:
                HideAutoFillListBox();
                _autoFillHandler.HandleAutoFillFinished(_autoFillListBox.SelectedItem as string);
                break;

            case Keys.Tab:
                HideAutoFillListBox();
                _autoFillHandler.HandleAutoFillFinished(_autoFillListBox.SelectedItem as string);
                break;
            }

            if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Tab))
            {
                e.Handled = e.SuppressKeyPress = true;
            }
        }