我想阅读一个键,用于在控制台中发布一些文本。示例:如果用户按下(KEY_XY),则运行代码:Console.WriteLine(EXAMPLE)。有人能帮助我吗?
答案 0 :(得分:0)
很简单,试试:
Private Sub Myform_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown
If (e.KeyCode = Keys.N AndAlso e.Modifiers = Keys.Control) Then 'note that here i'm using a modifier which means the code will be triggered if a user presses Ctrl+N, u can replace/edit it the way you want
'whatever that you want
End If