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

📄 frmnote.frm

📁 我同学艾大桥的记事本程序
💻 FRM
📖 第 1 页 / 共 3 页
字号:
Private Sub printer_Click()                '打印
    Me.cmdiag1og.ShowPrinter
End Sub
Private Sub exit_Click()                    '退出

 Unload Me
 
End Sub

                                            '编辑操作
                                                                
Private Sub RTxtfile_SelChange()           '根据是否选择文本来决定菜单的显示及字体字号等的改变

    If rtxtfile.SelLength = 0 Then         '如果没有选定文本则某些菜单和工具不可用
        cut.Enabled = False: tbrtool.Buttons(10).Enabled = False
        copy.Enabled = False: tbrtool.Buttons(11).Enabled = False
        del.Enabled = False: tbrtool.Buttons(13).Enabled = False
       Else                               '定义某些菜单和工具为可用
        cut.Enabled = True: tbrtool.Buttons(10).Enabled = True
        copy.Enabled = True: tbrtool.Buttons(11).Enabled = True
        del.Enabled = True: tbrtool.Buttons(13).Enabled = True
   End If
   
   If IsNull(rtxtfile.SelFontName) Then   '如果当前选定文字字体无法确定则将字体栏置为空
      cmbfont.Text = ""
   Else
      cmbfont.Text = rtxtfile.SelFontName '根据所选定文字的字体来改变当前字体栏的显示
   End If
   
  If IsNull(rtxtfile.SelFontSize) Then    '如果当前选定文字字号无法确定则将字号栏置为空
     cmbsize.Text = ""
  Else
    cmbsize.Text = rtxtfile.SelFontSize   '根据所选定文字的字号来改变当前字号栏的显示
  End If
  
  If rtxtfile.SelBold = True Then         '根据所选定文字的样式来决定当前样式是否被选中
     trbfmt.Buttons(1).Value = tbrPressed
  Else
     trbfmt.Buttons(1).Value = tbrUnpressed
  End If
  
  If rtxtfile.SelItalic = True Then
     trbfmt.Buttons(2).Value = tbrPressed
  Else
     trbfmt.Buttons(2).Value = tbrUnpressed
  End If
  
  If rtxtfile.SelUnderline = True Then
     trbfmt.Buttons(3).Value = tbrPressed
  Else
     trbfmt.Buttons(3).Value = tbrUnpressed
  End If
  
  If rtxtfile.SelAlignment = rtfLeft Then '根据文本的排列格式来决定格式工具是否按下
     trbfmt.Buttons(5).Value = tbrPressed
  Else
     trbfmt.Buttons(5).Value = tbrUnpressed
  End If
  
  If rtxtfile.SelAlignment = rtfCenter Then
     trbfmt.Buttons(6).Value = tbrPressed
  Else
     trbfmt.Buttons(6).Value = tbrUnpressed
  End If
  
  If rtxtfile.SelAlignment = rtfRight Then
     trbfmt.Buttons(7).Value = tbrPressed
  Else
     trbfmt.Buttons(7).Value = tbrUnpressed
  End If
    
End Sub
                                         
Private Sub cx_Click()                      '撤消

End Sub
                                           
Private Sub copy_Click()                    '复制

    With Clipboard
        .Clear                              '清空剪切板内容
        .SetText rtxtfile.SelText           '将选定文本放入系统剪切板
   End With
   
End Sub
Private Sub cut_Click()                   '剪切
     
     With Clipboard
        .Clear
        .SetText rtxtfile.SelText
        rtxtfile.SelText = ""           '将选定文本替换为空
    End With
    
End Sub

Private Sub paster_Click()                '粘贴
     
     rtxtfile.SelText = Clipboard.GetText '将当前所选定文本替换为剪切板上的文本

End Sub
Private Sub del_Click()                    '删除
      
     rtxtfile.SelText = ""

End Sub

Private Sub find_Click()                    '查找
    With frmreplace                         '改变替换窗体为查找窗体
        .labreptop.Visible = False
        .txtrep.Visible = False
        .cmdrep.Visible = False
        .cmdall.Visible = False
        .chkop1.Top = 600
        .chkop2.Top = 960
        .Cmdcancle.Top = 600
        .Height = 1890
        .Caption = "查找"
        .Show 0, Me
    End With
End Sub

Private Sub findnext_Click()                '查找下一个
   Call find
End Sub

Private Sub replace_Click()                 '替换
 frmreplace.Show 0, Me
End Sub

Private Sub conv_Click()                    '转到


End Sub


Private Sub selall_Click()                  '全选
    
    rtxtfile.SelStart = 0                   '设置文本插入或选定文本的起始位置
    rtxtfile.SelLength = Len(rtxtfile.Text) '选定文本长度为整个文档的长度

End Sub


Private Sub datetime_Click()                '在当前位置插入当前日期和时间
    
    rtxtfile.Text = Date + Time
    
End Sub
                                            '复选菜单栏
Private Sub statu_Click()                   '状态栏
  If statu.Checked = True Then
        statu.Checked = False
        Stabar.Visible = False
        rtxtfile.Height = rtxtfile.Height + Stabar.Height
  Else
        statu.Checked = True
        Stabar.Visible = True
        rtxtfile.Height = rtxtfile.Height - Stabar.Height
 End If
  
End Sub

Private Sub tool_Click()                    '工具栏

  If tool.Checked = True Then
     tool.Checked = False
     cbrtool.Bands(1).Visible = False
     
  Else
     tool.Checked = True
     cbrtool.Bands(1).Visible = True
     cbrtool.Visible = True
  End If
  
  If tool.Checked = False And format.Checked = False Then
    cbrtool.Visible = False
  End If

End Sub
Private Sub format_Click()                   '格式栏

    If format.Checked = True Then
        format.Checked = False
        cbrtool.Bands(2).Visible = False
   Else
        format.Checked = True
        cbrtool.Bands(2).Visible = True
        cbrtool.Visible = True
  End If
  
If tool.Checked = False And format.Checked = False Then
    cbrtool.Visible = False
End If
If cbrtool.Visible = False Then
      rtxtfile.Top = 0
      rtxtfile.Height = rtxtfile.Height + 870
End If
End Sub

                                            '如果格式栏和工具栏均被屏蔽



                                            '格式操作
Private Sub font_Click()                    '字体
    
    With cmdiag1og
        .Flags = &H403                      '指定字体集
        .ShowFont                           '显示字体选取对话框
        
        rtxtfile.SelFontName = .FontName
        rtxtfile.SelFontSize = .FontSize
        rtxtfile.SelUnderline = .FontUnderline
        rtxtfile.SelBold = .FontBold
        rtxtfile.SelItalic = .FontItalic
    End With

End Sub
Private Sub dl_Click()                      '段落

End Sub
                                              
Private Sub back_Click()                    '背景
   
   With cmdiag1og
        .ShowColor
        rtxtfile.BackColor = .color
   
   End With
   
End Sub

Private Sub bore_Click()                   '前景
   
   With cmdiag1og
        .ShowColor
        rtxtfile.SelColor = .color
  End With
  
End Sub
                       


                                          '帮助操作
Private Sub helptop_Click()                '帮助主题

End Sub

Private Sub aboutnote_click()            '关于记事本
 
 frmabout.Show
 
End Sub
                                        
                                        '工具栏
Private Sub tbrtool_ButtonClick(ByVal Button As MSComctlLib.Button)

    Select Case Button.Index
        Case 1: filenew_Click           '新建
        Case 2: fileopen_Click          '打开
        Case 3: filesave_Click          '保存
        Case 5: printer_Click           '打印
        Case 6: viewer_Click            '预览
        Case 8: replace_Click           '查找替换
        Case 10: cut_Click              '剪切
        Case 11: copy_Click             '复制
        Case 12: paster_Click           '粘贴
        Case 13: cx_Click               '撤消
    End Select

End Sub
                                        

                                        '格式栏
Private Sub trbfmt_ButtonClick(ByVal Button As MSComctlLib.Button)
     
     Select Case Button.Index
        Case 1                          '粗体
         If trbfmt.Buttons(1).Value = tbrPressed Then
            rtxtfile.SelBold = True
         Else
             rtxtfile.SelBold = False
         End If
        
        Case 2                         '斜体
          If trbfmt.Buttons(2).Value = tbrPressed Then
             rtxtfile.SelItalic = True
          Else
             rtxtfile.SelItalic = False
          End If
         
        Case 3                         '下划线
          If trbfmt.Buttons(3).Value = tbrPressed Then
             rtxtfile.SelUnderline = True
          Else
             rtxtfile.SelUnderline = False
          End If
         
        Case 5                         '左对齐
          If trbfmt.Buttons(5).Value = tbrPressed Then
             trbfmt.Buttons(6).Value = tbrUnpressed
             trbfmt.Buttons(7).Value = tbrUnpressed
             rtxtfile.SelAlignment = rtfLeft
          End If
         
        Case 6                         '居中
          If trbfmt.Buttons(6).Value = tbrPressed Then
             trbfmt.Buttons(5).Value = tbrUnpressed
             trbfmt.Buttons(7).Value = tbrUnpressed
             rtxtfile.SelAlignment = rtfCenter
          End If
                        
        Case 7                         '右对齐
          If trbfmt.Buttons(7).Value = tbrPressed Then
             trbfmt.Buttons(5).Value = tbrUnpressed
             trbfmt.Buttons(6).Value = tbrUnpressed
             rtxtfile.SelAlignment = rtfRight
          End If
     End Select
     

End Sub

Private Sub cmbfont_Click()           '字体选择
    rtxtfile.SelFontName = cmbfont.Text
End Sub

Private Sub cmbsize_Click()          '字号选择
    rtxtfile.SelFontSize = cmbsize.Text
End Sub

⌨️ 快捷键说明

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