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

📄 form1.frm

📁 这是我的课程设计!
💻 FRM
字号:
VERSION 5.00
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Begin VB.Form Form1 
   Caption         =   "文档1"
   ClientHeight    =   3465
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   7305
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   MousePointer    =   99  'Custom
   ScaleHeight     =   3465
   ScaleWidth      =   7305
   WhatsThisButton =   -1  'True
   WhatsThisHelp   =   -1  'True
   Begin RichTextLib.RichTextBox RichTextBox1 
      Height          =   4815
      HelpContextID   =   1
      Left            =   0
      TabIndex        =   0
      Top             =   0
      WhatsThisHelpID =   1
      Width           =   8895
      _ExtentX        =   15690
      _ExtentY        =   8493
      _Version        =   393217
      BorderStyle     =   0
      Enabled         =   -1  'True
      HideSelection   =   0   'False
      ScrollBars      =   3
      TextRTF         =   $"Form1.frx":0000
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim strFile As String
Dim strFind As String
Dim bChanged As Boolean  '判断文本是否变化的变量
Property Get HasChanged() As Boolean
    HasChanged = bChanged
End Property
Property Let HasChanged(b As Boolean)
    bChanged = b
End Property
Sub SaveFile()                                                                '***************保存函数***************
    If Me.OpenFile <> "" Then  '如果当前处理的文件路径不为空按原路径保存
        Me.RichTextBox1.SaveFile Me.OpenFile, rtfText
        bChanged = False       '判断文本是否变化的变量
    Else
        With MDIForm1.CommonDialog1
            .Filter = "文本文件(*.txt)|*.txt|所有文件(*.*)|*.*"
              '设置标志为当文件已经存在时提示是否覆盖
            .Flags = cdlOFNOverwritePrompt  '&H2
            .ShowSave
            If .FileName <> "" Then  '用户输入了正确的文件名并按确定键
                Me.RichTextBox1.SaveFile .FileName, rtfText
                Me.OpenFile = .FileName
                Me.Caption = .FileName
                bChanged = False
            End If
        End With
    End If
End Sub
Sub SaveFileAs()                                                                '***************另存为函数***************
    With MDIForm1.CommonDialog1
        .FileName = Me.OpenFile
        .Filter = " 文本文件(*.txt)|*.txt|所有文件(*.*)|*.*"
        .ShowSave
        If .FileName <> "" Then
            Me.RichTextBox1.SaveFile .FileName, rtfText
            Me.OpenFile = .FileName
            Me.Caption = .FileName
            bChanged = False
        End If
    End With
End Sub
Property Get OpenFile() As String
    OpenFile = strFile
End Property
Property Let OpenFile(sFile As String)
   strFile = sFile
End Property
Private Sub Form_Load()                                                     '***************Form1窗体加载时***************
        MDIForm1.mEdit.Visible = True
        MDIForm1.mFilePrint.Enabled = True
        MDIForm1.mFileSave.Enabled = True
        MDIForm1.mFileSaveAs.Enabled = True
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)     '***************窗体卸载时***************
  Dim myexit As String
  myexit = MsgBox("需要保存吗?", 32 + 4, "保存")                         '显示问号和[是][不]按钮
  If myexit = vbYes Then
     SaveFile
  Else
     Me.Hide
  End If
 End Sub
Private Sub RichTextBox1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single) '***************右键***************
    If Button = 2 Then
        PopupMenu MDIForm1.mEdit
    End If
End Sub

⌨️ 快捷键说明

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