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

前端 未结 2 1546
孤城傲影
孤城傲影 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:13

    The difference that I have observed is that the value in KeyCode only holds a Keys enumeration value for the key that triggered the current firing of the event. KeyData, on the other hand, will contain a logical OR of the value in KeyCode with any modifier keys (CTRL, SHIFT, ALT, etc.) that are held at the time.

提交回复
热议问题