📄 find.frm
字号:
VERSION 5.00
Begin VB.Form frmFind
BorderStyle = 3 'Fixed Dialog
Caption = "查找"
ClientHeight = 1860
ClientLeft = 2760
ClientTop = 3750
ClientWidth = 4395
DrawMode = 6 'Mask Pen Not
Icon = "Find.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Picture = "Find.frx":08CA
ScaleHeight = 1860
ScaleWidth = 4395
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.TextBox Text2
BeginProperty Font
Name = "Fixedsys"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1800
TabIndex = 6
Top = 840
Width = 2535
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "Fixedsys"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1800
TabIndex = 5
Top = 360
Width = 2535
End
Begin VB.CommandButton Command1
Caption = "查找下一个(&N)"
Height = 375
Index = 2
Left = 3240
TabIndex = 4
Top = 1440
Width = 975
End
Begin VB.CommandButton Command1
Caption = "替换(&S)"
Height = 375
Index = 1
Left = 1800
TabIndex = 3
Top = 1440
Width = 975
End
Begin VB.CommandButton Command1
Caption = "查找(&F)"
Height = 375
Index = 0
Left = 480
TabIndex = 2
Top = 1440
Width = 975
End
Begin VB.Label Label2
Caption = "所要替换内容(&H)"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 1
Top = 840
Width = 1575
End
Begin VB.Label Label1
Caption = "所要查找内容(&L)"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 0
Top = 480
Width = 1695
End
End
Attribute VB_Name = "frmFind"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Const conHwndTopmost = -1 'API函数的 SetWindowsPos 函数的设置值
Const conHwndNoTopmost = -2
Const conSwpNoActivate = &H10
Const conSwpShowWindow = &H40
Dim X As Long
Private Sub Command1_Click(index As Integer)
Select Case index
Case 0
Dim FoundPos As Integer
Dim FoundLine As Integer
Dim s As String
'查找 TextBox 控件中指定的文本。
s = Trim(Text1.Text)
Form3.SetFocus
FoundPos = Form3.Ric.Find(s, 0, Len(Form3.Ric.Text), rtfWholeWord)
'根据是否找到文本,显示相应的消息。
If FoundPos <> -1 Then
'返回已找到文本所在行的行号。
FoundLine = Form3.Ric.GetLineFromChar(FoundPos)
'MsgBox "Word found on line " & CStr(FoundLine)
Else
MsgBox "查找内容未找到", vbExclamation + vbOKOnly, "查找"
Exit Sub
End If
Case 1
Form3.SetFocus
Form3.Ric.SelText = frmFind.Text2.Text
Case 2
s = Trim(Text1.Text)
Form3.SetFocus
For X = X To Len(Form3.Ric.Text)
FoundPos = Form3.Ric.Find(s, X, Len(Form3.Ric.Text), rtfWholeWord)
X = X + 5
If FoundPos <> -1 Then Exit For
Next X
'根据是否找到文本,显示相应的消息。
If FoundPos <> -1 Then
'返回已找到文本所在行的行号。
FoundLine = Form3.Ric.GetLineFromChar(FoundPos)
'MsgBox "Word found on line " & CStr(FoundLine)
Else
MsgBox "查找内容未找到", vbExclamation + vbOKOnly, "查找"
End If
End Select
End Sub
Private Sub Form_Load()
SetWindowPos hwnd, conHwndTopmost, 250, 150, 325, 155, conSwpNoActivate Or conSwpShowWindow
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -