private bool handleKeyCommand(object sender, KeyMaping keyMaping) { TextBox textBox = sender as TextBox; //Ctrl + A = select all if (keyMaping.CtrlPressed && keyMaping.KeyValue == (int)'A') { if (textBox != null) { textBox.SelectAll(); return(true); } } return(false); }
private void txtBox_KeyUp(object sender, KeyEventArgs e) { KeyMaping mapping = _dataStorage[(sender as Control).Name] as KeyMaping; if (mapping == null) { mapping = new KeyMaping(); _dataStorage[(sender as Control).Name] = mapping; } mapping.AltPressed = e.Alt; mapping.CtrlPressed = e.Control; mapping.ShiftPressed = e.Shift; mapping.KeyValue = e.KeyValue; }