📄 frmfind.frm
字号:
VERSION 5.00
Begin VB.Form Frmfind
BorderStyle = 1 'Fixed Single
Caption = "查找"
ClientHeight = 1755
ClientLeft = 45
ClientTop = 330
ClientWidth = 4905
Enabled = 0 'False
Icon = "Frmfind.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1755
ScaleWidth = 4905
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton CmdCancel
Caption = "取消"
Height = 375
Left = 3720
TabIndex = 7
Top = 960
Width = 975
End
Begin VB.CommandButton CmdReplace
Caption = "替换"
Height = 375
Left = 3720
TabIndex = 6
Top = 600
Width = 975
End
Begin VB.CommandButton CmdFind
Caption = "查找"
Height = 375
Left = 3720
TabIndex = 5
Top = 240
Width = 975
End
Begin VB.CheckBox Check1
Caption = "区分大小写"
Height = 375
Left = 720
TabIndex = 4
Top = 1320
Width = 1335
End
Begin VB.TextBox Text2
Height = 375
Left = 720
TabIndex = 1
Top = 840
Width = 2535
End
Begin VB.TextBox Text1
Height = 375
Left = 720
TabIndex = 0
Top = 240
Width = 2535
End
Begin VB.Label Label2
Caption = "替换"
Height = 255
Left = 120
TabIndex = 3
Top = 900
Width = 495
End
Begin VB.Label Label1
Caption = "查找"
Height = 255
Left = 120
TabIndex = 2
Top = 300
Width = 495
End
End
Attribute VB_Name = "Frmfind"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim direction As Integer
Dim compare As Integer
Dim position As Integer
Private Sub CmdCancel_Click()
Unload Me
Me.Hide
End Sub
Private Sub CmdFind_Click()
If Me.Check1.Value = 0 Then
compare = vbBinaryCompare
Else
compare = vbTextCompare
End If
position = InStr(position + 1, Frmoffice.RichTextBox1.Text, Me.Text1.Text, compare)
If position > 0 Then
Me.CmdReplace.Enabled = True
Frmoffice.RichTextBox1.SelStart = position - 1
Frmoffice.RichTextBox1.SelLength = Len(Text1.Text)
Me.SetFocus
Else
MsgBox "未找到指定字符串"
Me.CmdReplace.Enabled = False
Me.SetFocus
End If
End Sub
Private Sub CmdReplace_Click()
Frmoffice.RichTextBox1.SelText = Me.Text2.Text
Me.SetFocus
End Sub
Private Sub Form_Load()
Me.Check1.Value = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -