⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmrpl.frm

📁 记事本
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmRpl 
   Caption         =   "替换"
   ClientHeight    =   2745
   ClientLeft      =   5040
   ClientTop       =   4545
   ClientWidth     =   5355
   LinkTopic       =   "Form1"
   ScaleHeight     =   2745
   ScaleWidth      =   5355
   Begin VB.CheckBox chkLU 
      Caption         =   "区分大小写"
      Height          =   375
      Left            =   600
      TabIndex        =   6
      Top             =   2040
      Width           =   1215
   End
   Begin VB.CommandButton qiut 
      Caption         =   "取消"
      Height          =   375
      Left            =   3720
      TabIndex        =   5
      Top             =   1800
      Width           =   1455
   End
   Begin VB.CommandButton cmdRpla 
      Caption         =   "全部替换"
      Height          =   375
      Left            =   3720
      TabIndex        =   4
      Top             =   1320
      Width           =   1455
   End
   Begin VB.CommandButton cmdRpl 
      Caption         =   "替换"
      Height          =   375
      Left            =   3720
      TabIndex        =   3
      Top             =   840
      Width           =   1455
   End
   Begin VB.CommandButton cmdFind 
      Caption         =   "查找下一个"
      Height          =   375
      Left            =   3720
      TabIndex        =   2
      Top             =   360
      Width           =   1455
   End
   Begin VB.TextBox txtRpl 
      Height          =   375
      Left            =   1080
      TabIndex        =   1
      Top             =   1320
      Width           =   2295
   End
   Begin VB.TextBox txtfind 
      Height          =   375
      Left            =   1080
      TabIndex        =   0
      Top             =   600
      Width           =   2295
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "替换为"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   240
      TabIndex        =   8
      Top             =   1320
      Width           =   630
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "查找内容"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   120
      TabIndex        =   7
      Top             =   720
      Width           =   840
   End
End
Attribute VB_Name = "frmRpl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim StartPos As Integer
Private Sub cmdFind_Click() '查找
sting = frmNote.rtfText.Text
If Fstring = "" Then
 Fstring = txtfind.Text
Else
If txtfind.Text <> Fstring And txtfind.Text <> "" Then
 Fstring = txtfind.Text
 End If
End If
If StartPos = 0 Then
 StartPos = 1
End If
  If chkLU.Value = 1 Then '判断是否区分大小写
    FoundPos = InStr(StartPos, sting, Fstring, 0)
  Else
    FoundPos = InStr(StartPos, sting, Fstring, 1)
  End If
  If FoundPos > 0 Then  '找到了匹配字符串
    MyPos = FoundPos - 1
    frmNote.rtfText.SelStart = MyPos '高亮显示
    frmNote.rtfText.SelLength = Len(txtfind.Text)
    StartPos = FoundPos + Len(Fstring)
  Else
    MsgBox "“" + txtfind.Text + " ”" + "没找到!", vbInformation, "记事本"
  End If
End Sub
Private Sub cmdRpl_Click() '替换
   If frmNote.rtfText.SelLength <> 0 Then
    frmNote.rtfText.SelText = frmRpl.txtRpl.Text
   End If
End Sub
Private Sub cmdRpla_Click() '全部替换
 frmNote.rtfText.Text = Replace(frmNote.rtfText.Text, txtfind, txtRpl)
End Sub

Private Sub Form_Load()
  cmdFind.Enabled = False
  cmdRpl.Enabled = False
  cmdRpla.Enabled = False
  StartPos = 1
End Sub

Private Sub qiut_Click() '取消
 Unload Me
End Sub

Private Sub txtfind_Change() '设置按钮可用不可用
If txtfind.Text <> "" Then
 cmdFind.Enabled = True
 cmdRpl.Enabled = True
 cmdRpla.Enabled = True
 Else
  cmdFind.Enabled = False
  cmdRpl.Enabled = False
  cmdRpla.Enabled = False
 End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -