📄 frmfind.frm
字号:
VERSION 5.00
Begin VB.Form frmFind
Caption = "查找/替换"
ClientHeight = 1650
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 1650
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton FindNextCmd
Caption = "查找下一个"
Height = 375
Left = 1800
TabIndex = 6
Top = 1200
Width = 1095
End
Begin VB.CommandButton ExchangeCmd
Caption = "替换"
Height = 375
Left = 3240
TabIndex = 5
Top = 1200
Width = 1095
End
Begin VB.CommandButton FindCmd
Caption = "查找"
Height = 375
Left = 360
TabIndex = 4
Top = 1200
Width = 1095
End
Begin VB.TextBox ExchangeTxt
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 320
Left = 840
TabIndex = 3
Top = 680
Width = 3735
End
Begin VB.TextBox FindTxt
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 320
Left = 840
TabIndex = 0
Top = 80
Width = 3735
End
Begin VB.Label Label3
Caption = "替换:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 2
Top = 720
Width = 735
End
Begin VB.Label Label1
Caption = "查找:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 1
Top = 120
Width = 855
End
End
Attribute VB_Name = "frmFind"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim FindPos As Long
' 查找
Private Sub FindCmd_Click()
frmEditor!txtEdit.SelStart = 0
FindPos = frmEditor!txtEdit.Find(FindTxt)
If FindPos = -1 Then
MsgBox "没有找到!", vbCritical, "记事本"
Else
FindPos = FindPos + Len(FindTxt)
frmEditor!txtEdit.SetFocus
End If
End Sub
' 查找下一个
Private Sub FindNextCmd_Click()
frmEditor!txtEdit.SelStart = FindPos ' 改变插入点位置
FindPos = frmEditor!txtEdit.Find(FindTxt, FindPos)
If FindPos = -1 Then
MsgBox "没有找到!", vbCritical, "记事本"
Else
FindPos = FindPos + Len(FindTxt)
frmEditor!txtEdit.SetFocus
End If
End Sub
' 替换
Private Sub ExchangeCmd_Click()
' 循环进行替换
Do While frmEditor!txtEdit.Find(FindTxt) <> -1
frmEditor!txtEdit.SelText = ExchangeTxt
Loop
MsgBox "替换完毕!", vbInformation, "记事本"
frmEditor!txtEdit.SetFocus
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -