我正在尝试在用户按住 ctrl 按钮并单击 NotifyIcon 时运行不同的代码。
我的代码不起作用,但我觉得它清楚地解释了我何时尝试这样做。这是在鼠标点击事件下。
Private Sub NotifyIcon_MouseClick(ByVal sender As Object, ByVal e As MouseEventArgs) Handles NotifyIcon.MouseClick
If (e.Modifiers = Keys.Control) Then
MsgBox("CTRL was pressed !")
Else
MsgBox("CTRL was not pressed !")
End If
End Sub
最佳答案
不太精通VB,但你也把它标记为C#,你切换过来应该是微不足道的。
private void Form1_MouseClick(object sender, MouseEventArgs e) {
if (Control.ModifierKeys == Keys.Control) {
Console.WriteLine("Ctrl+Click");
}
}
关于vb.net - 当您 ctrl + 单击 WinForm 中的按钮时运行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17839869/