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

📄 form6.frm

📁 模拟文件管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form6 
   Caption         =   "文本编辑器"
   ClientHeight    =   6105
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   6795
   LinkTopic       =   "Form6"
   ScaleHeight     =   6105
   ScaleWidth      =   6795
   StartUpPosition =   1  '所有者中心
   Begin VB.CommandButton Command1 
      Caption         =   "退出"
      Height          =   495
      Index           =   5
      Left            =   5280
      TabIndex        =   7
      Top             =   5040
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "关闭"
      Height          =   495
      Index           =   4
      Left            =   5280
      TabIndex        =   6
      Top             =   4320
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "另存"
      Height          =   495
      Index           =   3
      Left            =   5280
      TabIndex        =   5
      Top             =   3600
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "保存"
      Height          =   495
      Index           =   2
      Left            =   5280
      TabIndex        =   4
      Top             =   2880
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "打开"
      Height          =   495
      Index           =   1
      Left            =   5280
      TabIndex        =   3
      Top             =   2160
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "新建"
      Height          =   495
      Index           =   0
      Left            =   5280
      TabIndex        =   2
      Top             =   720
      Width           =   975
   End
   Begin VB.TextBox Text1 
      Height          =   5895
      Left            =   240
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   1
      Top             =   120
      Width           =   4575
   End
   Begin VB.PictureBox Picture1 
      Align           =   4  'Align Right
      Height          =   6105
      Left            =   4860
      ScaleHeight     =   6045
      ScaleWidth      =   1875
      TabIndex        =   0
      Top             =   0
      Width           =   1935
      Begin VB.CommandButton Command2 
         Caption         =   "字体"
         Height          =   495
         Left            =   360
         TabIndex        =   8
         Top             =   1440
         Width           =   975
      End
   End
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   2520
      Top             =   5640
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
      Filter          =   "*.*|*.txt|*.TXT|*.Txt"
      FilterIndex     =   2
   End
End
Attribute VB_Name = "Form6"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click(Index As Integer)
n = Index
Select Case n
  Case 0:
     Text1.Text = ""
     Form6.Caption = "未命名"
     Case 1:
      CommonDialog1.Filter = "All Files (*.*)|*.*|Text Files (*.txt)|*.txt|Batch Files (*.bat)|*.bat"
      CommonDialog1.ShowOpen  '显示打开对话框
      fname = CommonDialog1.FileName
      If fname <> "" Then
         Text1.Text = ""
         Open fname For Input As #1
         b = ""
         Do Until EOF(1)
          Line Input #1, nextline
          b = b & nextline & Chr(13) & Chr(10)
          Loop
          Close #1
          Text1.Text = b
          End If
          Form6.Caption = fname
          
  Case 2:
     If Form6.Caption = "文本编辑器" Or Form6.Caption = "未命名" Or Form6.Caption = "" Then
     CommonDialog1.ShowSave   '显示另存为对话框
     fname = CommonDialog1.FileName
     Else
       fname = Form6.Caption
       End If
    If fname <> "" Then
      Open fname For Output As #1
      Print #1, Text1.Text
      Close #1
      End If
Case 3:
     CommonDialog1.ShowSave
     fname = CommonDialog1.FileName
     If fname <> "" Then
       Open fname For Output As #1
       Print #1, Text1.Text
       Close #1
       End If
 Case 4:
      Text1.Text = ""
     Form1.Show
     Form6.Hide
Case 5:
      Text1.Text = ""
      End
      
      End Select
     
      
          
          
          
          
End Sub

Private Sub Command2_Click()
'将 Cancel 设置成 True。
              CommonDialog1.CancelError = True
              On Error GoTo ErrHandler
              '设置 Flags 属性。
              CommonDialog1.Flags = cdlCFBoth Or cdlCFEffects
              '显示“字体”对话框。
              CommonDialog1.ShowFont
              '根据用户的选择来设置文本属性。
              Text1.Font.Name = CommonDialog1.FontName
              Text1.Font.Size = CommonDialog1.FontSize
              Text1.Font.Bold = CommonDialog1.FontBold
              Text1.Font.Italic = CommonDialog1.FontItalic
              Text1.Font.Underline = CommonDialog1.FontUnderline
              Text1.FontStrikethru = CommonDialog1.FontStrikethru
              Text1.ForeColor = CommonDialog1.Color
              Exit Sub
ErrHandler:
              '用户按了“取消”按钮。
              Exit Sub

End Sub

Private Sub Form_Resize() '为了使改变窗体大小的时候文本框能随之改变
With Text1
.Left = 0
.Top = 0
.Height = Form6.ScaleHeight
.Width = Form6.ScaleWidth - Picture1.Width
End With

End Sub

⌨️ 快捷键说明

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