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

📄 form1005.frm

📁 VB实验教程源码
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "文件管理器"
   ClientHeight    =   3330
   ClientLeft      =   165
   ClientTop       =   855
   ClientWidth     =   5610
   LinkTopic       =   "Form1"
   ScaleHeight     =   3330
   ScaleWidth      =   5610
   StartUpPosition =   3  '窗口缺省
   Begin VB.FileListBox File1 
      Height          =   2610
      Left            =   2280
      TabIndex        =   2
      Top             =   480
      Width           =   3255
   End
   Begin VB.DirListBox Dir1 
      Height          =   2610
      Left            =   120
      TabIndex        =   1
      Top             =   480
      Width           =   2175
   End
   Begin VB.DriveListBox Drive1 
      Height          =   300
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   2175
   End
   Begin VB.Menu mnuFileNew 
      Caption         =   "新建文件夹"
   End
   Begin VB.Menu mnuCopyFile 
      Caption         =   "复制文件"
   End
   Begin VB.Menu mnuDel 
      Caption         =   "删除"
      Begin VB.Menu mnuDelFolder 
         Caption         =   "删除文件夹"
      End
      Begin VB.Menu mnuDelFile 
         Caption         =   "删除文件"
      End
   End
   Begin VB.Menu mnuExit 
      Caption         =   "退出"
   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 Fso As New FileSystemObject
Dim Folder1 As Folder
Dim TextF1 As TextStream

Private Sub Dir1_Change()
'改变目录
    File1.Path = Dir1.Path
    Set Folder1 = Fso.getfolder(Dir1.Path)
End Sub

Private Sub Drive1_Change()
'改变驱动器
    Dir1.Path = Drive1.Drive
End Sub


Private Sub Form_Load()
'装载窗体
    Set Fso = CreateObject("Scripting.FileSystemObject")
End Sub

Private Sub mnuCopyFile_Click()
'复制文件
    Fso.CopyFile Dir1.Path & "\" & File1.FileName, Dir1.Path & "\" & "新建文件"
    File1.Refresh
End Sub


Private Sub mnuDelFile_Click()
'删除文件
    Dim Ans As Integer
    Ans = MsgBox("是否删除?", vbOKCancel, "删除")
    If Ans = 1 Then
        Fso.DeleteFile Dir1.Path & "\" & File1.FileName
    End If
    File1.Refresh
End Sub

Private Sub mnuDelFolder_Click()
'删除文件夹
    Dim Ans As Integer
    Ans = MsgBox("是否删除?", vbOKCancel, "删除")
    If Ans = 1 Then
        Fso.DeleteFolder Dir1.Path
    End If
    Dir1.Refresh
End Sub

Private Sub mnuExit_Click()
'退出菜单
    End
End Sub


Private Sub mnuFileNew_Click()
'新建文件夹菜单
    Fso.CreateFolder (Dir1.Path & "新建文件夹")
    Dir1.Refresh
End Sub

⌨️ 快捷键说明

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