C#: In the keydown event of a textbox, how do you detect currently pressed modifiers + keys?

前端 未结 2 1873
北海茫月
北海茫月 2021-01-06 15:55

C#: In the keydown event of a textbox, how do you detect currently pressed modifiers + keys?

I did the following, but I\'m not too familiar with these operators so I

2条回答
  •  伪装坚强ぢ
    2021-01-06 16:37

    according to msdn linkt

    private void txtShortcut_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Alt || e.Control || e.Shift))
            {
                lbLogger.Items.Add(e.ToString() + " + " +
                    "show non-modifier key being pressed here");
            }
        }
    

提交回复
热议问题