如何在.net?
中的textbox keydown事件中验证iscontrolkeys答案 0 :(得分:1)
This msdn page should do the trick - 检查按键中返回的keypresseventsargs或this keydown page应该允许您查询控制键(使用相关的.Net枚举)
答案 1 :(得分:0)
在C#中,
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.ControlKey)
{
//Do some work
}
}
在VB.NET中,
Private Sub textBox1_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs)
If e.KeyCode = Keys.ControlKey Then
'Do some work'
End If
End Sub