VB的问题拉 高手快来拉!!!

来源:百度知道 编辑:UC知道 时间:2024/05/28 18:49:30
Private Sub Text1_KeyPress(KeyAscii As Integer)
Print "q"
End Sub

Private Sub Command2_KeyPress(KeyAscii As Integer)
Print "d"
End Sub
为什么我按下键盘只能打d ? q 呢?
还有true 为-1? false 为0吗?

Private Sub Text1_KeyPress(KeyAscii As Integer)
Print chr(keyascii)
End Sub

Private Sub Command2_KeyPress(KeyAscii As Integer)
Print chr(keyascii)
End Sub
true 为-1, false 为0

Text1获得焦点时你只能打 q,因为Print "q",无论你按下什么键都只有打印q,Command2获得焦点时你只能打 d,因为Print "d",VBplusplus的回答中chr(keyascii)将keyascii转换为字母,所以对应的按键按下后都可以打印出来