dim ctrl_press as booleanPrivate Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 17 Then ctrl_press = True End SubPrivate Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 10 And ctrl_press Then MsgBox "you press ctrl+enter" End SubPrivate Sub Form_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 17 Then ctrl_press = False End Sub
KeyAscii = 10 不是 13
Option Explicit Dim ctrl_press As BooleanPrivate Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 17 Then ctrl_press = True End SubPrivate Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 10 And ctrl_press Then KeyAscii = False ctrl_press = False End If End SubPrivate Sub Form_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 17 Then ctrl_press = False End Sub
If KeyCode = 17 Then ctrl_press = True
End SubPrivate Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 10 And ctrl_press Then MsgBox "you press ctrl+enter"
End SubPrivate Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = 17 Then ctrl_press = False
End Sub
Dim ctrl_press As BooleanPrivate Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 17 Then ctrl_press = True
End SubPrivate Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 10 And ctrl_press Then
KeyAscii = False
ctrl_press = False
End If
End SubPrivate Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = 17 Then ctrl_press = False
End Sub
---------
最简单但又绝对行之有效的方法:把键盘上的CTRL和ENTER抠掉
呵呵