Test if the Ctrl key is down using C#

后端 未结 6 1236
一整个雨季
一整个雨季 2020-12-01 09:59

I have a form that the user can double click on with the mouse and it will do something. Now I want to be able to know if the user is also holding the Ctrl key do

6条回答
  •  北海茫月
    2020-12-01 10:52

    This works for me:

     if(Keyboard.IsKeyDown(Key.LeftCtrl))
        {}
    

    And add references to PresentationCore and WindowsBase

提交回复
热议问题