请问:怎么样能够实现焦点在查找窗体上,同时让文本框里查到的字符反显,就像WINDOWS的记事本一样?谢谢!
另外请问,richtextbox的自动换行怎么实现啊?
[此贴子已经被作者于2007-5-30 10:07:53编辑过]
'这个是一个示例程序,把下面的内容保存到一个文本文件,然后把那个文本文件后缀名改为.Frm就可以在VB中打开了。
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command1 
      Caption         =   "搜索下一个"
      Height          =   375
      Left            =   3240
      TabIndex        =   2
      Top             =   225
      Width           =   1050
   End
   Begin VB.TextBox Text2 
      Height          =   330
      Left            =   270
      TabIndex        =   1
      Text            =   "Text2"
      Top             =   270
      Width           =   2805
   End
   Begin VB.TextBox Text1 
      Height          =   2130
      Left            =   270
      MultiLine       =   -1  'True
      TabIndex        =   0
      Text            =   "Form1.frx":0000
      Top             =   675
      Width           =   4020
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
  Static I As Long
Start:
  I = InStr(I + 1, Text1.Text, Text2.Text)
  If I Then
    Text1.SetFocus
    Text1.SelStart = I - 1
    Text1.SelLength = Len(Text2.Text)
  ElseIf MsgBox("    搜索完毕,未找到相同的字符串!" & vbCrLf & "是否重新搜索一遍?", vbYesNo, "字符串搜索") = vbYes Then
    GoTo Start
  End If
End Sub
[此贴子已经被作者于2007-5-30 14:37:52编辑过]
