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

📄 find.frm

📁 一个简单的记事本的VB程序。 和系统自带的差不多功能
💻 FRM
字号:
VERSION 5.00
Begin VB.Form FrmFind 
   BorderStyle     =   4  'Fixed ToolWindow
   Caption         =   "查找"
   ClientHeight    =   2070
   ClientLeft      =   45
   ClientTop       =   315
   ClientWidth     =   4845
   Icon            =   "Find.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2070
   ScaleWidth      =   4845
   ShowInTaskbar   =   0   'False
   StartUpPosition =   1  '所有者中心
   Begin VB.CommandButton Command4 
      Caption         =   "全部替换(&A)"
      Enabled         =   0   'False
      Height          =   315
      Left            =   3495
      TabIndex        =   8
      Top             =   1650
      Width           =   1215
   End
   Begin VB.CommandButton Command3 
      Caption         =   "替换(&T)"
      Enabled         =   0   'False
      Height          =   315
      Left            =   3495
      TabIndex        =   7
      Top             =   1275
      Width           =   1215
   End
   Begin VB.CommandButton Command2 
      Cancel          =   -1  'True
      Caption         =   "取消(&C)"
      Height          =   315
      Left            =   3495
      TabIndex        =   6
      Top             =   765
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "查找(&F)"
      Default         =   -1  'True
      Enabled         =   0   'False
      Height          =   315
      Left            =   3495
      TabIndex        =   5
      Top             =   330
      Width           =   1215
   End
   Begin VB.CheckBox Check1 
      Appearance      =   0  'Flat
      Caption         =   "区分大小写(&B)"
      Enabled         =   0   'False
      ForeColor       =   &H80000008&
      Height          =   255
      Left            =   120
      TabIndex        =   4
      Top             =   885
      Width           =   1545
   End
   Begin VB.TextBox Text2 
      Appearance      =   0  'Flat
      Height          =   270
      Left            =   90
      TabIndex        =   3
      Top             =   1680
      Width           =   3300
   End
   Begin VB.TextBox Text1 
      Appearance      =   0  'Flat
      Height          =   270
      Left            =   90
      TabIndex        =   0
      Top             =   345
      Width           =   3300
   End
   Begin VB.Line Line2 
      BorderColor     =   &H8000000D&
      X1              =   135
      X2              =   4665
      Y1              =   1215
      Y2              =   1215
   End
   Begin VB.Line Line1 
      BorderWidth     =   2
      X1              =   120
      X2              =   4650
      Y1              =   1215
      Y2              =   1215
   End
   Begin VB.Label Label2 
      Caption         =   "替换为:"
      Height          =   255
      Left            =   120
      TabIndex        =   2
      Top             =   1440
      Width           =   1335
   End
   Begin VB.Label Label1 
      Caption         =   "欲查找的字符:"
      Height          =   255
      Left            =   120
      TabIndex        =   1
      Top             =   120
      Width           =   1335
   End
End
Attribute VB_Name = "FrmFind"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
On Error Resume Next
Dim n As Long
If FrmMain.Text1.SelText <> "" Then FrmMain.Text1.SelStart = FrmMain.Text1.SelStart + FrmMain.Text1.SelLength
n = InStr(IIf(FrmMain.Text1.SelStart = 0, 1, FrmMain.Text1.SelStart), FrmMain.Text1.Text, Text1.Text)
If n <> 0 Then
    FrmMain.Text1.SelStart = n - 1
    FrmMain.Text1.SelLength = Len(Text1.Text)
    FrmMain.SetFocus
Else
    MsgBox "未找到你所要查找的字符串" & vbNewLine & "点击确定再从头开始查找!", 16
    FrmMain.Text1.SelStart = 0
End If
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Command3_Click()
FrmMain.Text1.SelText = Text2.Text
End Sub

Private Sub Command4_Click()
Call Command1_Click
Call Command3_Click
End Sub

Private Sub Text1_Change()
Command1.Enabled = IIf(Text1.Text = "", False, True)
Command4.Enabled = Command1.Enabled
Command3.Enabled = Command1.Enabled

End Sub

⌨️ 快捷键说明

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