📄 查找替换.frm
字号:
VERSION 5.00
Begin VB.Form searchandreplace
Caption = "查找与替换"
ClientHeight = 2220
ClientLeft = 60
ClientTop = 345
ClientWidth = 6045
LinkTopic = "Form1"
ScaleHeight = 2220
ScaleWidth = 6045
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command3
Caption = "取消"
Height = 375
Left = 4800
TabIndex = 3
Top = 1560
Width = 975
End
Begin VB.CommandButton Command1
Caption = "查找/替换"
Height = 375
Left = 4800
TabIndex = 2
Top = 960
Width = 975
End
Begin VB.TextBox Text2
Height = 375
Left = 960
TabIndex = 1
Top = 1560
Width = 3495
End
Begin VB.TextBox Text1
Height = 375
Left = 960
TabIndex = 0
Top = 960
Width = 3495
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "查找与替换"
BeginProperty Font
Name = "华文新魏"
Size = 21.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00008000&
Height = 570
Left = 1320
TabIndex = 6
Top = 120
Width = 2415
End
Begin VB.Label 替换
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "替换为:"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 120
TabIndex = 5
Top = 1680
Width = 960
End
Begin VB.Label 查找
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "查找:"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 120
TabIndex = 4
Top = 1080
Width = 720
End
End
Attribute VB_Name = "searchandreplace"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim fstr As String, value As Integer, foundpos As Long
Dim a As Integer, object As String
fstr = Text1.Text
foundpos = fMainForm.ActiveForm.rtfText.Find(fstr, 0)
If foundpos = -1 Then
MsgBox "未发现要查找的字符串 ", 64, "查找与替换”"
Else
a = MsgBox("发现要查找的字符串,替换吗? ", 4 + 48, "查找与替换")
If a = 6 Then
object = Text2.Text
fMainForm.ActiveForm.rtfText.SelText = object
Where = fMainForm.ActiveForm.rtfText.Find(fstr, Where + Len(fstr))
If Where = -1 Then
MsgBox "搜索替换完毕!", 64, "查找与替换”"
End If
End If
End If
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
End Sub
Private Sub text1_change()
If Text1.Text <> "" Then
Command1.Enabled = True
Else
Command1.Enabled = False
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -