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

📄 7-1.frm

📁 vb6.0编程实例详解,很详细的介绍,对学习VB有帮助
💻 FRM
📖 第 1 页 / 共 2 页
字号:
VERSION 5.00
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   3570
   ClientLeft      =   165
   ClientTop       =   735
   ClientWidth     =   5265
   LinkTopic       =   "Form1"
   ScaleHeight     =   3570
   ScaleWidth      =   5265
   StartUpPosition =   3  '窗口缺省
   Begin MSComctlLib.ImageList ImageList2 
      Left            =   4200
      Top             =   1200
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   16
      ImageHeight     =   15
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   7
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "7-1.frx":0000
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "7-1.frx":0544
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "7-1.frx":0A88
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "7-1.frx":0FCC
            Key             =   ""
         EndProperty
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "7-1.frx":1510
            Key             =   ""
         EndProperty
         BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "7-1.frx":1A54
            Key             =   ""
         EndProperty
         BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "7-1.frx":1F98
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   3360
      Top             =   1200
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   16
      ImageHeight     =   15
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   7
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "7-1.frx":24DC
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "7-1.frx":2A20
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "7-1.frx":2F64
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "7-1.frx":34A8
            Key             =   ""
         EndProperty
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "7-1.frx":39EC
            Key             =   ""
         EndProperty
         BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "7-1.frx":3F30
            Key             =   ""
         EndProperty
         BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "7-1.frx":4474
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.Toolbar Toolbar1 
      Align           =   1  'Align Top
      Height          =   345
      Left            =   0
      TabIndex        =   1
      Top             =   0
      Width           =   5265
      _ExtentX        =   9287
      _ExtentY        =   609
      ButtonWidth     =   609
      ButtonHeight    =   556
      Appearance      =   1
      Style           =   1
      ImageList       =   "ImageList1"
      DisabledImageList=   "ImageList2"
      _Version        =   393216
      BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
         NumButtons      =   10
         BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "New"
            ImageIndex      =   1
         EndProperty
         BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "Open"
            ImageIndex      =   2
         EndProperty
         BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "Save"
            ImageIndex      =   3
         EndProperty
         BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
         BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "Print"
            ImageIndex      =   4
         EndProperty
         BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
         BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "Cut"
            ImageIndex      =   5
         EndProperty
         BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "Copy"
            ImageIndex      =   6
         EndProperty
         BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "Paste"
            ImageIndex      =   7
         EndProperty
         BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
      EndProperty
   End
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   120
      Top             =   960
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin RichTextLib.RichTextBox RichTextBox1 
      Height          =   735
      Left            =   1200
      TabIndex        =   0
      Top             =   1200
      Width           =   1575
      _ExtentX        =   2778
      _ExtentY        =   1296
      _Version        =   393217
      Enabled         =   -1  'True
      ScrollBars      =   3
      OLEDragMode     =   0
      OLEDropMode     =   1
      TextRTF         =   $"7-1.frx":49B8
   End
   Begin VB.Menu File 
      Caption         =   "文件(&F)"
      Begin VB.Menu New 
         Caption         =   "新建(&N)"
      End
      Begin VB.Menu Open 
         Caption         =   "打开(&O)"
      End
      Begin VB.Menu Save 
         Caption         =   "保存(&S)"
      End
      Begin VB.Menu Separate 
         Caption         =   "-"
         Index           =   1
      End
      Begin VB.Menu Print 
         Caption         =   "打印(&P)"
      End
      Begin VB.Menu separate0 
         Caption         =   "-"
         Visible         =   0   'False
      End
      Begin VB.Menu Recent 
         Caption         =   "Recent1"
         Index           =   0
         Visible         =   0   'False
      End
      Begin VB.Menu Recent 
         Caption         =   "Recent2"
         Index           =   1
         Visible         =   0   'False
      End
      Begin VB.Menu Recent 
         Caption         =   "Recent3"
         Index           =   2
         Visible         =   0   'False
      End
      Begin VB.Menu Recent 
         Caption         =   "Recent4"
         Index           =   3
         Visible         =   0   'False
      End
      Begin VB.Menu separate1 
         Caption         =   "-"
         Index           =   0
      End
      Begin VB.Menu Exit 
         Caption         =   "退出(&E)"
      End
   End
   Begin VB.Menu Edit 
      Caption         =   "编辑(&E)"
      Begin VB.Menu Cut 
         Caption         =   "剪切(&t)"
      End
      Begin VB.Menu Copy 
         Caption         =   "复制(&C)"
      End
      Begin VB.Menu Paste 
         Caption         =   "粘贴(&P)"
      End
      Begin VB.Menu se 
         Caption         =   "-"
      End
      Begin VB.Menu Find 
         Caption         =   "查找(&F)"
      End
      Begin VB.Menu FindN 
         Caption         =   "找下一个"
         Shortcut        =   {F3}
      End
   End
   Begin VB.Menu Edit_p 
      Caption         =   "edit_p"
      Visible         =   0   'False
      Begin VB.Menu Cut_p 
         Caption         =   "剪切"
      End
      Begin VB.Menu Copy_p 
         Caption         =   "复制"
      End
      Begin VB.Menu Paste_p 
         Caption         =   "粘贴"
      End
   End
   Begin VB.Menu Format 
      Caption         =   "格式(&F)"
      Begin VB.Menu Font 
         Caption         =   "字体..."
      End
      Begin VB.Menu Color 
         Caption         =   "颜色..."
      End
      Begin VB.Menu sep 
         Caption         =   "-"
      End
      Begin VB.Menu Bord 
         Caption         =   "粗体"
      End
      Begin VB.Menu Ita 
         Caption         =   "斜体"
      End
      Begin VB.Menu Del 
         Caption         =   "删除线"
      End
      Begin VB.Menu Und 
         Caption         =   "下画线"
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

'继续查找文本的起始位置
Dim FindPos As Integer
'需要查找的字符串
Dim FindStr As String
'文件修改标志
Dim TextChanged As Boolean
'文件名
Dim FileName As String


Private Sub Bord_Click()
    If Bord.Checked Then
        Bord.Checked = False
        RichTextBox1.SelBold = False
    Else
        Bord.Checked = True
        RichTextBox1.SelBold = True
    End If
    
End Sub

Private Sub Color_Click()
    On Error Resume Next
    CommonDialog1.CancelError = True
    
    CommonDialog1.Flags = cdlCFBoth
    '显示颜色选择对话窗口
    CommonDialog1.ShowColor
    '修改当前颜色
    RichTextBox1.SelColor = CommonDialog1.Color
End Sub

Private Sub Copy_Click()
    '保存选择的字符串
    Clipboard.SetText RichTextBox1.SelRTF

    If Clipboard.GetFormat(vbCFText) Then
        Paste.Enabled = True '下拉菜单
        Paste_p.Enabled = True '弹出菜单
        Toolbar1.Buttons("Paste").Enabled = True '工具条按钮
    Else
        Paste.Enabled = False
        Paste_p.Enabled = False
        Toolbar1.Buttons("Paste").Enabled = False
    End If
End Sub

Private Sub Copy_p_Click()
    Copy_Click
End Sub

Private Sub Cut_Click()
    '保存选择的字符串
    Clipboard.SetText RichTextBox1.SelRTF
    '删除该字符串
    RichTextBox1.SelText = ""
    
    If Clipboard.GetFormat(vbCFText) Then
        Paste.Enabled = True
        Paste_p.Enabled = True
        Toolbar1.Buttons("Paste").Enabled = True
    Else
        Paste.Enabled = False
        Paste_p.Enabled = False
        Toolbar1.Buttons("Paste").Enabled = False
    End If
End Sub

Private Sub Cut_p_Click()
    Cut_Click
End Sub

Private Sub Del_Click()
    If Del.Checked Then
        Del.Checked = False
        RichTextBox1.SelStrikeThru = False
    Else
        Del.Checked = True
        RichTextBox1.SelStrikeThru = True
    End If

End Sub

Private Sub Exit_Click()
    Dim stat As Integer
    
    If TextChanged Then
        stat = MsgBox("文件已被修改,是否保存 ?", vbYesNo Or vbQuestion, "警告")
    End If
    
    If stat = 6 Then
    '用户选择保存文件
        Save_Click
    End If
    
    Unload Me
End Sub

Private Sub Find_Click()
    FindStr = InputBox("请输入字符串 :", "输入", RichTextBox1.SelText)
    
    If Len(FindStr) > 0 Then
        RichTextBox1.Find FindStr, 0
        FindPos = RichTextBox1.SelStart + 1
        
        '允许“找下一个...”操作
        FindN.Enabled = True
    End If
End Sub

Private Sub FindN_Click()
    If Len(FindStr) > 0 Then
        RichTextBox1.Find FindStr, FindPos
        FindPos = RichTextBox1.SelStart + 1
    End If
End Sub

Private Sub Font_Click()
    On Error GoTo Errstr
    CommonDialog1.CancelError = True

⌨️ 快捷键说明

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