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

📄 fileexplo2.frm

📁 改压缩包是一个用vb做的简单的记事本
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form2 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "查找替换"
   ClientHeight    =   2220
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   5745
   Icon            =   "fileexplo2.frx":0000
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2220
   ScaleWidth      =   5745
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  '窗口缺省
   Begin VB.CheckBox Check1 
      Caption         =   "区分大小写"
      Height          =   375
      Left            =   240
      TabIndex        =   13
      Top             =   1680
      Width           =   1215
   End
   Begin VB.Frame Frame3 
      Caption         =   "方向"
      Height          =   855
      Left            =   1560
      TabIndex        =   10
      Top             =   1200
      Width           =   1215
      Begin VB.OptionButton Option1 
         Caption         =   "向上"
         Height          =   255
         Index           =   1
         Left            =   240
         TabIndex        =   12
         Top             =   480
         Width           =   735
      End
      Begin VB.OptionButton Option1 
         Caption         =   "向下"
         Height          =   255
         Index           =   0
         Left            =   240
         TabIndex        =   11
         Top             =   240
         Width           =   735
      End
   End
   Begin VB.Frame Frame2 
      Height          =   2175
      Left            =   4320
      TabIndex        =   3
      Top             =   0
      Width           =   1335
      Begin VB.CommandButton Command4 
         Caption         =   "取  消"
         Height          =   375
         Left            =   120
         TabIndex        =   7
         TabStop         =   0   'False
         Top             =   1680
         Width           =   1095
      End
      Begin VB.CommandButton Command3 
         Caption         =   "全部替换"
         Height          =   375
         Left            =   120
         TabIndex        =   6
         TabStop         =   0   'False
         Top             =   1200
         Width           =   1095
      End
      Begin VB.CommandButton Command2 
         Caption         =   "替  换"
         Height          =   375
         Left            =   120
         TabIndex        =   5
         TabStop         =   0   'False
         Top             =   720
         Width           =   1095
      End
      Begin VB.CommandButton Command1 
         Caption         =   "开始查找"
         Height          =   375
         Left            =   120
         TabIndex        =   4
         TabStop         =   0   'False
         Top             =   240
         Width           =   1095
      End
   End
   Begin VB.Frame Frame1 
      Height          =   825
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   4095
      Begin VB.TextBox Text1 
         Height          =   270
         Index           =   1
         Left            =   960
         TabIndex        =   9
         Text            =   "Text1"
         Top             =   480
         Width           =   3015
      End
      Begin VB.TextBox Text1 
         Height          =   270
         Index           =   0
         Left            =   960
         TabIndex        =   2
         Text            =   "Text1"
         Top             =   120
         Width           =   3015
      End
      Begin VB.Label Label2 
         Caption         =   "替换内容"
         Height          =   195
         Left            =   120
         TabIndex        =   8
         Top             =   560
         Width           =   855
      End
      Begin VB.Label Label1 
         Caption         =   "查找内容"
         Height          =   195
         Left            =   120
         TabIndex        =   1
         Top             =   200
         Width           =   855
      End
   End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Dim findtext As String, onetext As String
Dim start1 As Long, end1 As Long
Const SWP_NOMOVE = 2
Const SWP_NOSIZE = 1
Const HWND_TOPMOST = -1
Const HWNDNOTOPMOST = -2
Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Dim findhow As Long
Private Sub comtf1(ft1 As Boolean)
Command1.Enabled = ft1
Command2.Enabled = ft1
Command3.Enabled = ft1
End Sub

Private Sub Command1_Click()
Me.MousePointer = 13
Dim findlen As Long, onelen As Long
findtext = Text1(0).Text
onetext = Form1.Text1.Text
If Check1.Value = 0 Then
findtext = UCase(findtext)
onetext = UCase(onetext)
End If
findlen = Len(Text1(0).Text)
onelen = Len(Form1.Text1.Text)
If Option1(0).Value = True Then
For i = start1 To onelen
If findtext = Mid$(onetext, i, findlen) Then
Form1.Text1.SetFocus
Form1.Text1.SelStart = i - 1
Form1.Text1.SelLength = findlen
start1 = i + findlen
Command2.Enabled = True
Command1.Caption = "继续查找"
findhow = findhow + 1
Me.MousePointer = 0
Exit Sub
End If
Next i
MsgBox "此次查找完成,共找到" + CStr(findhow) + "处", 64, "查找替换"
findhow = 0
start1 = 1
Command2.Enabled = False
Command1.Caption = "开始查找"
Else
If end1 = -1 Then
end1 = onelen
End If
For i = end1 To 1 Step -1
If findtext = Mid$(onetext, i, findlen) Then
Form1.Text1.SetFocus
Form1.Text1.SelStart = i - 1
Form1.Text1.SelLength = findlen
end1 = i - findlen
Command2.Enabled = True
Command1.Caption = "继续查找"
findhow = findhow + 1
Me.MousePointer = 0
Exit Sub
End If
Next i
MsgBox "此次查找完成,共找到" + CStr(findhow) + "处", 64, "查找替换"
findhow = 0
end1 = -1
Command2.Enabled = False
Command1.Caption = "开始查找"
End If
Me.MousePointer = 0
End Sub

Private Sub Command2_Click()
Form1.Text1.SelText = Text1(1).Text
Command2.Enabled = False
If Option1(0).Value = True Then
start1 = start1 - Len(Text1(0).Text) + Len(Text1(1).Text)
End If
End Sub

Private Sub Command3_Click()
Me.MousePointer = 13
Form1.flag3 = False
Dim findlen As Long, onelen As Long
Static findhow1 As Long
findtext = Text1(0).Text
onetext = Form1.Text1.Text
If Check1.Value = 0 Then
findtext = UCase(findtext)
onetext = UCase(onetext)
End If
findlen = Len(Text1(0).Text)
onelen = Len(Form1.Text1.Text)
For i = onelen To 1 Step -1
If findtext = Mid$(onetext, i, findlen) Then
Form1.Text1.SetFocus
Form1.Text1.SelStart = i - 1
Form1.Text1.SelLength = findlen
Form1.Text1.SelText = Text1(1).Text
findhow1 = findhow1 + 1
End If
Next i
MsgBox "此次替换完成,共替换" + CStr(findhow1) + "处", 64, "查找替换"
findhow1 = 0
Form1.flag3 = True
Call Form1.Text1_Change
Me.MousePointer = 0
End Sub

Private Sub Command4_Click()
Unload Me
End Sub

Private Sub Form_Load()
Me.Left = 9500
Me.Top = 0
Text1(0).Text = ""
Text1(1).Text = ""
Check1.Value = 0
comtf1 False
Option1(0).Value = True
Dim success As Long
success = SetWindowPos(Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)
findhow = 0
End Sub

Private Sub Form_Unload(Cancel As Integer)
Form1.Text1.SetFocus
End Sub

Private Sub Text1_Change(Index As Integer)
Static textlen As Integer
textlen = Len(Text1(0).Text)
If textlen > 0 Then
comtf1 True
Command2.Enabled = False
Else
comtf1 False
End If
start1 = 1
end1 = -1
Command1.Caption = "开始查找"
findhow = 0
End Sub

⌨️ 快捷键说明

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