'这样 Private Sub RichTextBox1_GotFocus() Dim TEMP As Control For Each TEMP In Me.Controls TEMP.TabStop = False Next End SubPrivate Sub RichTextBox1_KeyPress(KeyAscii As Integer) If KeyAscii = 9 Then KeyAscii = 0 SendKeys (" ") End If End SubPrivate Sub RichTextBox1_LostFocus() Dim TEMP As Control For Each TEMP In Me.Controls TEMP.TabStop = True Next End Sub
Private Sub RichTextBox1_KeyPress(KeyAscii As Integer) If KeyAscii = 9 Then KeyAscii = 0 SendKeys (" ") End If End Sub 你用KeyDown事件替换KeyPress事件即可。 KeyDown中的TAB的Keycode可以利用Debug.Print Keycode 得到。
Private Sub RichTextBox1_GotFocus()
Dim TEMP As Control
For Each TEMP In Me.Controls
TEMP.TabStop = False
Next
End SubPrivate Sub RichTextBox1_KeyPress(KeyAscii As Integer)
If KeyAscii = 9 Then
KeyAscii = 0
SendKeys (" ")
End If
End SubPrivate Sub RichTextBox1_LostFocus()
Dim TEMP As Control
For Each TEMP In Me.Controls
TEMP.TabStop = True
Next
End Sub
If KeyAscii = 9 Then
KeyAscii = 0
SendKeys (" ")
End If
End Sub
你用KeyDown事件替换KeyPress事件即可。
KeyDown中的TAB的Keycode可以利用Debug.Print Keycode 得到。