我想在VB .Net中的富文本框中捕获keydown事件。
根据我看到的文档和示例,我只需要使用e.Handled = True但这不起作用,我仍然将密钥值放在富文本框中。
我的代码是
Private Sub Tagging_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles rtxReference.KeyDown
If ((e.KeyCode = Keys.Z) AndAlso e.Control) Then
'MsgBox("Undo")
rtxReference.Text = sPrevious
Else
If cbxHotKeyTags.Checked Then
If e.KeyCode = Keys.T Then
sTagName = "article-title"
ElseIf e.KeyCode = Keys.V Then
sTagName = "volume"
ElseIf e.KeyCode = Keys.F Then
sTagName = "fpage"
ElseIf e.KeyCode = Keys.L Then
sTagName = "lpage"
ElseIf e.KeyCode = Keys.I Then
sTagName = "issuee"
End If
e.Handled = True
End If
End If
End Sub