Can I determine whether a Ctrl key press is Left Ctrl or Right Ctrl?

后端 未结 4 1830
温柔的废话
温柔的废话 2021-01-16 09:24

I want to determine whether a CTRL key is LEFT CTRL or RIGHT CTRL key when it is pressed. How can I do this?

4条回答
  •  无人共我
    2021-01-16 09:58

    You can easily check the status of the Keyboard using System.Windows.Input.Keybaord.IsKeyDown() to determine if the Right or Left Control key is pressed:

    if (Keyboard.IsKeyDown(Key.LeftCtrl)
         {}
    else if (Keyboard.IsKeyDown(Key.RightCtrl)
         {}
    end if
    

提交回复
热议问题