I use this code to determine if modifier keys are held in the KeyDown event of a text field.
private void txtShortcut_KeyDown(object sender, KeyEventArgs e)
{
if (e.Shift || e.Control || e.Alt)
{
txtShortcut.Text = (e.Shift.ToString() + e.Control.ToString() + e.Alt.ToString() + e.KeyCode.ToString());
}
}
How can I display the actual modifier key name and not the bool result, and also display the non-modifier key pressed at the end of the modifier key if the non-modifier key, such as the letter A, is pressed at the same time too? Is there a way to do all this in the same txtShortcut.Text = (); line?
Mike power
source
share