Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 检查是否按下了某个键?_Vb.net_Visual Studio - Fatal编程技术网

Vb.net 检查是否按下了某个键?

Vb.net 检查是否按下了某个键?,vb.net,visual-studio,Vb.net,Visual Studio,我需要检查我的VB.net应用程序中是否按下了SHIFT或CTRL键,有什么想法吗?(获取布尔值)检查该链接: 这是关于KeyEventArgs类的,其中有一些示例如何检测shift/ctrl键等。我假设您希望看到整个应用程序。为此,窗体或控件具有“keypress”或“keydown”事件。你可以用这些事件检查它们。单击事件选项卡,您将看到它们以下内容将返回True或False,具体取决于当时是否按下该键。从你问题的措辞来看,我假设你不是在问事件处理,其他答案都提到了这一点 My.Comput

我需要检查我的VB.net应用程序中是否按下了SHIFT或CTRL键,有什么想法吗?(获取布尔值)

检查该链接:


这是关于KeyEventArgs类的,其中有一些示例如何检测shift/ctrl键等。

我假设您希望看到整个应用程序。为此,窗体或控件具有“keypress”或“keydown”事件。你可以用这些事件检查它们。单击事件选项卡,您将看到它们

以下内容将返回True或False,具体取决于当时是否按下该键。从你问题的措辞来看,我假设你不是在问事件处理,其他答案都提到了这一点

My.Computer.Keyboard.ShiftKeyDown
My.Computer.Keyboard.CtrlKeyDown

如果在控制台应用程序、WinForms、WPF中。。。请澄清你的问题。非常非常酷!我在想一定有某种KB对象,但是在
环境下查看。谢谢
If Control.ModifierKeys = Keys.Shift Or Control.ModifierKeys = Keys.Control Then
    ' Shift, Ctrl, or Shift+Ctrl is being pressed
Else
    ' Neither Shift nor Ctrl is being pressed
End If