VB怎样实现锁定键盘上的一些键?
发布网友
发布时间:2022-05-10 12:09
我来回答
共2个回答
热心网友
时间:2023-10-09 07:59
凑个热闹:
Private Sub Form_Load()
Me.KeyPreview = True
End Sub
Private Sub Form_KeyPress(Key As Integer)
被锁字符集 = "ABCa啊" '你可以将想锁定的任何键或字符放在该字符串中
Key = IIf(InStr(被锁字符集, Chr(Key)) > 0, 0, Key)
End Sub
热心网友
时间:2023-10-09 07:59
Private Sub Form_Load()
Me.KeyPreview = True
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = Asc("A") Then KeyAscii = 0 '锁定A
If KeyAscii = Asc("a") Then KeyAscii = 0 '锁定a
'.......
End Sub