Private Sub Form_Load() RichTextBox1.MousePointer = 1 End SubPrivate Sub RichTextBox1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single) If RichTextBox1.SelText = "" And Button <> 1 Then Text1.SetFocus End If End SubPrivate Sub RichTextBox1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single) If RichTextBox1.SelText = "" And Button <> 1 Then Text1.SetFocus SendKeys "{Home}" End If End SubText1可为所以能得到焦点的任何控件,如果整个窗体只能有RichTextBox1控件时,可将Text1放在RichTextBox1控件的下面,这样就可以达到楼主的效果了!
RichTextBox1.MousePointer = 1
End SubPrivate Sub RichTextBox1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
If RichTextBox1.SelText = "" And Button <> 1 Then
Text1.SetFocus
End If
End SubPrivate Sub RichTextBox1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
If RichTextBox1.SelText = "" And Button <> 1 Then
Text1.SetFocus
SendKeys "{Home}"
End If
End SubText1可为所以能得到焦点的任何控件,如果整个窗体只能有RichTextBox1控件时,可将Text1放在RichTextBox1控件的下面,这样就可以达到楼主的效果了!