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

📄 frmmain123.frm

📁 vb1weqt rfwergertgerwtewr t
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Begin VB.Form frmmain 
   Caption         =   "我的记事本"
   ClientHeight    =   6690
   ClientLeft      =   165
   ClientTop       =   825
   ClientWidth     =   8115
   LinkTopic       =   "Form1"
   ScaleHeight     =   6690
   ScaleWidth      =   8115
   StartUpPosition =   3  '窗口缺省
   Begin RichTextLib.RichTextBox Rtext 
      Height          =   735
      Left            =   2400
      TabIndex        =   1
      Top             =   1320
      Width           =   1455
      _ExtentX        =   2566
      _ExtentY        =   1296
      _Version        =   393217
      BackColor       =   -2147483647
      ScrollBars      =   3
      TextRTF         =   $"frmmain123.frx":0000
   End
   Begin MSComDlg.CommonDialog cmndlg 
      Left            =   2400
      Top             =   2520
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin MSComctlLib.StatusBar StatusBar1 
      Align           =   2  'Align Bottom
      Height          =   255
      Left            =   0
      TabIndex        =   0
      Top             =   6435
      Width           =   8115
      _ExtentX        =   14314
      _ExtentY        =   450
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   3
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Enabled         =   0   'False
            Text            =   "记事本"
            TextSave        =   "记事本"
         EndProperty
         BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
         EndProperty
         BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Style           =   5
            TextSave        =   "16:15"
         EndProperty
      EndProperty
   End
   Begin VB.Menu mnufile 
      Caption         =   "文件(&F)"
      NegotiatePosition=   1  'Left
      Begin VB.Menu mnunew 
         Caption         =   "新建(&N)"
         Shortcut        =   ^N
      End
      Begin VB.Menu mnuopen 
         Caption         =   "打开(&O)...."
         Shortcut        =   ^O
      End
      Begin VB.Menu mnusave 
         Caption         =   "保存(&S)...."
         Shortcut        =   ^S
      End
      Begin VB.Menu mnusaveother 
         Caption         =   "另存为...."
      End
      Begin VB.Menu mnupaint 
         Caption         =   "打印(&P)...."
      End
      Begin VB.Menu mnuline 
         Caption         =   "-"
      End
      Begin VB.Menu mnuexit 
         Caption         =   "退出"
         Shortcut        =   ^E
      End
   End
   Begin VB.Menu mnuedit 
      Caption         =   "编辑(&E)"
      Begin VB.Menu mnucopy 
         Caption         =   "复制"
         Shortcut        =   ^C
      End
      Begin VB.Menu mnucut 
         Caption         =   "剪切"
         Shortcut        =   ^X
      End
      Begin VB.Menu mnupaste 
         Caption         =   "粘贴"
         Shortcut        =   ^V
      End
      Begin VB.Menu mnuline1 
         Caption         =   "-"
      End
      Begin VB.Menu mnutihuan 
         Caption         =   "替换(&T)"
      End
      Begin VB.Menu mnudate 
         Caption         =   "时间/日期(&D)"
      End
   End
   Begin VB.Menu mnusee 
      Caption         =   "查看(&V)"
      Begin VB.Menu mnustatus 
         Caption         =   "状态栏"
      End
   End
   Begin VB.Menu mnutool 
      Caption         =   "工具(&T)"
      Begin VB.Menu mnufont 
         Caption         =   "字体(F)"
      End
      Begin VB.Menu mnucharacter 
         Caption         =   "字符统计"
      End
   End
   Begin VB.Menu mnuhelp 
      Caption         =   "帮助(&H)"
      Begin VB.Menu mnuabout 
         Caption         =   "关于记事本"
      End
      Begin VB.Menu mnunote 
         Caption         =   "记事本说明"
      End
   End
End
Attribute VB_Name = "frmmain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim fpath_name As String, modified As Boolean, oldtext As String
 Private Sub Form_Load()
   With Rtext
   .TabIndex = 0
   .Left = 0
   .Width = frmmain.ScaleWidth
   .Height = frmmain.ScaleHeight - StatusBar1.Height
   End With
  mnustatus.Checked = True
  mnucopy.Enabled = False
  mnucut.Enabled = False
  
  fpath_name = ""
  modified = False
  oldtext = ""
  Me.Caption = "未标题"
   StatusBar1.Panels.Item(2) = "运行"
 End Sub
Private Sub savefile()
 If fpath_name = "" Then
  On Error Resume Next
  cmndlg.CancelError = True
  cmndlg.Filter = "text.files|(*txt)|rtf.files|(*RTF)"
  cmndlg.ShowSave
  If Err.Number = 32755 Then Exit Sub
   If cmndlg.FileName <> "" Then
    If cmndlg.FilterIndex = 1 Then
     Rtext.savefile cmndlg.FileName, 1
    Else
     Rtext.savefile cmndlg.FileName
    End If
   End If
  Else
    If Right(fpath_name, 3) = "txt" Then
     Rtext.savefile fpath_Pname, 1
    Else
     Rtext.savefile fpath_name
    End If
 End If
End Sub
Private Sub Form_Resize()
 With Rtext
   .TabIndex = 0
   .Top = 0
   .Left = 0
   .Width = frmmain.ScaleWidth
   .Height = frmmain.ScaleHeight - StatusBar1.Height
End With
End Sub

Private Sub mnuabout_Click()
frmabout.Show
Me.Hide
End Sub

Private Sub mnucharacter_Click()
Frmcharacter.Show

End Sub

Private Sub mnucopy_Click()
Clipboard.Clear
Clipboard.SetText Rtext.SelText
End Sub

Private Sub mnucut_Click()
Clipboard.SetText Rtext.SelText
Rtext.SelText = ""
End Sub

Private Sub mnudel_Click()
Rtext.SelText = ""
End Sub

Private Sub mnudate_Click()
Rtext.Text = Rtext.Text & Now
End Sub

Private Sub mnunote_Click()
MsgBox "欢迎使用我的记事本", vbOKOnly + vbInformation, "欢迎使用"

End Sub

Private Sub mnupaste_Click()
Rtext.SelText = Clipboard.GetText()
End Sub

Private Sub mnuedit_Click()
If Rtext.SelText <> "" Then
  mnucopy.Enabled = True
  mnucut.Enabled = True
Else
  mnucopy.Enabled = False
  mnucut.Enabled = False
End If
End Sub

Private Sub mnuexit_Click()
End
End Sub

Private Sub mnufind_Click()
chazhao_frm.Show
End Sub

Private Sub mnufont_Click()
cmndlg.Flags = &H103
cmndlg.ShowFont
If cmndlg.FontName <> "" Then
Rtext.SelFontName = cmndlg.FontName
End If
With Rtext
  .SelFontName = cmndlg.FontName
  .SelFontSize = cmndlg.FontSize
  .SelBold = cmndlg.FontBold
  .SelItalic = cmndlg.FontItalic
  .SelUnderline = cmndlg.FontUnderline
  .SelStrikeThru = cmndlg.FontStrikethru
  .SelColor = cmndlg.Color
 End With
End Sub

Private Sub mnunew_Click()
Dim saveit As Integer
If modified = True Then
 saveit = MsgBox("文件" & Me.Caption & "的内容已更改,是否保存更改?", 3)
 If saveit = 2 Then Exit Sub
 If saveit = 6 Then savefile
End If
  Rtext.Text = ""
  fpath_name = ""
  modified = False
  oldtext = ""
  Me.Caption = "无标题"
 
End Sub

Private Sub mnuopen_Click()
Dim saveit As Integer
If modified = True Then
 saveit = MsgBox("文件" & Me.Caption & "的内容已更改,是否保存更改?", 3)
 If saveit = 2 Then Exit Sub
 If saveit = 6 Then savefile
End If
On Error Resume Next
  cmndlg.CancelError = True
  cmndlg.Filter = "text.files|*.txt|rtf.files|*.RTF"
  cmndlg.ShowOpen
  If Err.Number = 32755 Then Exit Sub
  If cmndlg.FilterIndex = 1 Then
   Rtext.LoadFile cmndlg.FileName, rtfText
  Else
   Rtext.LoadFile cmndlg.FileName, rtfRTF
  End If
  Me.Caption = cmndlg.FileName
  fpath_name = cmndlg.FileName
  oldtext = Rtext.Text
End Sub



Private Sub mnupaint_Click()
 On Error Resume Next
  cmndlg.CancelError = True
  cmndlg.Filter = "text.file|(*txt)|rtf.file|(*RTF)"
  cmndlg.ShowPrinter
  If Err.Number = 32755 Then Exit Sub
  For i = 1 To cmndlg.Copies
    Printer.Print Rtext.Text
  Next i
  Printer.EndDoc
End Sub

Private Sub mnusave_Click()
If modified = True Then savefile
 Me.Caption = cmndlg.FileName
  fpath_name = ""
  oldtext = Rtext.Text
  modified = False
End Sub

Private Sub mnusaveother_Click()
savefile
End Sub

Private Sub mnustatus_Click()
mnustatus.Checked = Not mnustatus.Checked
StatusBar1.Visible = Not StatusBar1.Visible
End Sub

Private Sub mnutime_Click()
Frmtime.Show

End Sub




Private Sub mnutihuan_Click()
chazhao_frm.Show
End Sub

Private Sub Rtext_Change()
If Rtext.SelText <> "" Then
  mnucopy.Enabled = True
  mnucut.Enabled = True
  
Else
  mnucopy.Enabled = False
  mnucut.Enabled = False

End If
If oldtext <> Rtext.Text Then
 modified = True
End If
 
End Sub

⌨️ 快捷键说明

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