-->

如何检测在VB.NET多种改性剂和非修改键的组合?(How to detect combinatio

2019-10-23 04:26发布

有我在此尝试给出了问题的不同解决方案,但也似乎无法避开它。 我想检测 按Ctrl CKeyDown在VB.Net事件。

KeyPreview属性设置为true我的形式。

我试过是:

If e.Modifiers = (Keys.Shift And Keys.Control) And e.KeyCode = Keys.C Then
    'do the action
End If

任何帮助将非常感激!

Answer 1:

你的问题的意见是正确的:

If (e.KeyCode = Keys.C AndAlso e.Modifiers = (Keys.Control Or Keys.Shift)) Then
    'Do what you want here
End If

如果你想给你的表格上任何地方发生,你需要把KeyPreview您的FormTrue

然后,您可以把它放在Form_KeyDown



文章来源: How to detect combination of multiple modifier and non-modifier keys in VB.NET?