📄 frmsfr.frm
字号:
VERSION 5.00
Begin VB.Form frmSFR
Caption = "Form1"
ClientHeight = 3945
ClientLeft = 60
ClientTop = 465
ClientWidth = 4800
Icon = "frmSFR.frx":0000
LinkTopic = "Form1"
ScaleHeight = 3945
ScaleWidth = 4800
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame3
Caption = "替换"
Height = 1695
Left = 120
TabIndex = 1
Top = 2160
Visible = 0 'False
Width = 4575
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 3360
TabIndex = 7
Top = 1200
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "替换"
Height = 375
Left = 2040
TabIndex = 6
Top = 1200
Width = 1095
End
Begin VB.TextBox Text2
Height = 375
Left = 1080
TabIndex = 5
Top = 743
Width = 3375
End
Begin VB.TextBox Text1
Height = 375
Left = 1080
TabIndex = 2
Top = 263
Width = 3375
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "替换为:"
Height = 180
Index = 1
Left = 120
TabIndex = 4
Top = 840
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "替换内容:"
Height = 180
Index = 0
Left = 120
TabIndex = 3
Top = 360
Width = 900
End
End
Begin VB.Frame Frame1
Caption = "查找"
Height = 1455
Left = 120
TabIndex = 0
Top = 120
Visible = 0 'False
Width = 4575
Begin VB.ComboBox Combo1
Height = 300
Left = 120
TabIndex = 13
Text = "Combo1"
Top = 1080
Width = 4335
End
Begin VB.CommandButton Command5
Caption = "查找下一个"
Height = 375
Left = 960
TabIndex = 12
Top = 600
Width = 1095
End
Begin VB.CommandButton Command4
Caption = "取消"
Height = 375
Left = 3360
TabIndex = 11
Top = 600
Width = 1095
End
Begin VB.CommandButton Command3
Caption = "查找"
Height = 375
Left = 2160
TabIndex = 10
Top = 600
Width = 1095
End
Begin VB.TextBox Text3
Height = 270
Left = 1440
TabIndex = 9
Top = 195
Width = 3015
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "要查找的内容:"
Height = 180
Left = 120
TabIndex = 8
Top = 240
Width = 1260
End
End
End
Attribute VB_Name = "frmSFR"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
'On Error Resume Next
Dim Code$
frmMain.ActiveForm.Text1.Text = frmMain.ActiveForm.rtfText.Text
Code$ = frmMain.ActiveForm.Text1.Text
Code$ = Replace$(Code$, Text1.Text, Text2.Text, 1, -1, vbBinaryCompare)
frmMain.ActiveForm.rtfText.Text = Code$
Unload Me
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
Select Case Combo1.Text
Case "整个单词匹配而不是单词片段": frmMain.ActiveForm.rtfText.Find Text1.Text, , rtfWholeWord
Case "忽略字体的差别": frmMain.ActiveForm.rtfText.Find Text1.Text, , rtfMatchCase
Case "找到的单词是否高亮显示": frmMain.ActiveForm.rtfText.Find Text1.Text, , rtfNoHighlight
Case Else: frmMain.ActiveForm.rtfText.Find Text1.Text
End Select
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Command5_Click()
Select Case Combo1.Text
Case "整个单词匹配而不是单词片段": frmMain.ActiveForm.rtfText.Find Text1.Text, , rtfWholeWord
Case "忽略字体的差别": frmMain.ActiveForm.rtfText.Find Text1.Text, , rtfMatchCase
Case "找到的单词是否高亮显示": frmMain.ActiveForm.rtfText.Find Text1.Text, , rtfNoHighlight
Case Else: frmMain.ActiveForm.rtfText.Find Text1.Text
End Select
End Sub
'rtfWholeWord为整个单词匹配而不是单词片段
'rtfMatchCase为是否忽略字体的差别
'rtfNoHighlight为找到的单词是否高亮显示
Public Function 功能(功_能 As String)
On Error Resume Next
Select Case 功_能
Case "查找"
Frame1.Visible = True
Frame1.Top = 60
Frame1.Left = 60
Me.Width = Frame1.Width + 240
Me.Height = Frame1.Height + 640
Me.Caption = "查找"
Combo1.Text = "什么都不选"
Combo1.AddItem "什么都不选"
Combo1.AddItem "整个单词匹配而不是单词片段"
Combo1.AddItem "忽略字体的差别"
Combo1.AddItem "找到的单词是否高亮显示"
Me.Show
Case "替换"
Frame3.Visible = True
Frame3.Top = 60
Frame3.Left = 60
Me.Width = Frame3.Width + 240
Me.Height = Frame3.Height + 640
Me.Caption = "替换"
Me.Show
End Select
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -