public SystemManager() { InitializeComponent(); leftListView.MouseDoubleClick += ListView_MouseDoubleClick; leftListView.GotFocus += ListView_GotFocus; leftListView.KeyDown += ListView_KeyDown; rightListView.MouseDoubleClick += ListView_MouseDoubleClick; rightListView.KeyDown += ListView_KeyDown; rightListView.GotFocus += ListView_GotFocus; WindowState = FormWindowState.Maximized; Text = Application.ProductName + @" " + Application.ProductVersion; textBoxFilter.TextChanged += TextBoxFilter_TextChanged; textBoxFilter.PreviewKeyDown += (o, args) => { //if (args.KeyCode >= Keys.A && args.KeyCode < Keys.Z) //if (args.IsInputKey) //{ //textBoxFilter.Text += "X";//char.ConvertFromUtf32(args.KeyValue); //} }; textBoxFilter.KeyDown += (o, args) => { if (args.KeyCode == Keys.Escape) { textBoxFilter.Hide(); textBoxFilter.Clear(); // clear after Hide(), otherwise TextChange event will trigger. _currentListView.Focus(); args.Handled = true; return; } if (args.KeyCode == Keys.Enter) { textBoxFilter.Hide(); textBoxFilter.Clear(); // clear after Hide(), otherwise TextChange event will trigger. _currentListView.Focus(); args.Handled = true; return; } if (args.KeyCode == Keys.Up) { _currentListView.ChangeSelectedItem(-1, textBoxFilter.Text, new[] { '[' }); args.Handled = true; } else if (args.KeyCode == Keys.Down) { _currentListView.ChangeSelectedItem(1, textBoxFilter.Text, new[] { '[' }); args.Handled = true; } args.Handled = true; }; }