What is the difference between the KeyCode and KeyData properties on the .NET WinForms key event argument objects?

前端 未结 2 1508
孤城傲影
孤城傲影 2021-01-31 15:04

The two key event argument classes KeyEventArgs and PreviewKeyDownEventArgs each have two properties, KeyCode and KeyData, wh

2条回答
  •  梦如初夏
    2021-01-31 15:04

    KeyCode is an enumeration that represents all the possible keys on the keyboard. KeyData is the KeyCode combined with the modifiers (Ctrl, Alt and/or Shift).

    Use KeyCode when you don't care about the modifiers, KeyData when you do.

提交回复
热议问题