📄 form2.frm
字号:
VERSION 5.00
Begin VB.Form Form2
Caption = "Form2"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form2"
ScaleHeight = 3090
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text1
Height = 375
Left = 1080
TabIndex = 5
Text = "Text1"
Top = 240
Width = 1335
End
Begin VB.TextBox Text2
Height = 375
Left = 1080
TabIndex = 4
Text = "Text1"
Top = 720
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "查找下一个"
Height = 375
Left = 3120
TabIndex = 3
Top = 240
Width = 1335
End
Begin VB.CommandButton Command2
Caption = "替换"
Height = 375
Left = 3120
TabIndex = 2
Top = 720
Width = 1335
End
Begin VB.CommandButton Command3
Caption = "全部替换"
Height = 375
Left = 3120
TabIndex = 1
Top = 1200
Width = 1335
End
Begin VB.CommandButton Command4
Caption = "取消"
Height = 375
Left = 3120
TabIndex = 0
Top = 1680
Width = 1335
End
Begin VB.Label Label1
Caption = "查找内容:"
Height = 255
Left = 120
TabIndex = 7
Top = 240
Width = 975
End
Begin VB.Label Label2
Caption = "替换为:"
Height = 255
Left = 120
TabIndex = 6
Top = 840
Width = 975
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim ask As Integer
Private Sub Command1_Click()
If Form1.RichTextBox1.SelStart <> 0 Then
Form1.RichTextBox1.SelStart = Form1.RichTextBox1.SelStart + Form1.RichTextBox1.SelLength
End If
Form1.RichTextBox1.Find Text1.Text, , Len(Form1.RichTextBox1)
If Form1.RichTextBox1.SelText = "" Then
ask = MsgBox("没有找到" + Text1.Text, vbOKOnly)
End If
End Sub
Private Sub Command2_Click()
If Form1.RichTextBox1.SelText = "" Then
ask = MsgBox("没有找到" + Text1.Text, vbOKOnly)
Else
Form1.RichTextBox1.SelText = Text2.Text
End If
Form1.RichTextBox1.SelStart = Form1.RichTextBox1.SelStart + Form1.RichTextBox1.SelLength
Form1.RichTextBox1.Find Text1.Text, , Len(Form1.RichTextBox1)
End Sub
Private Sub Command3_Click()
Command1_Click
Do While (Form1.RichTextBox1.SelText <> "")
Form1.RichTextBox1.SelText = Text2.Text
Form1.RichTextBox1.SelStart = Form1.RichTextBox1.SelStart + Form1.RichTextBox1.SelLength
Form1.RichTextBox1.Find Text1.Text, , Len(Form1.RichTextBox1)
If Form1.RichTextBox1.SelText = "" Then Exit Do
Loop
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
If Text1.Text = "" Then
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Else
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
End If
End Sub
Private Sub Text1_Change()
If Text1.Text = "" Then
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Else
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -