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

📄 form1.frm

📁 VB写的文件压缩算法
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   4545
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   5820
   LinkTopic       =   "Form1"
   ScaleHeight     =   4545
   ScaleWidth      =   5820
   StartUpPosition =   3  'Windows Default
   Begin VB.TextBox Text4 
      Height          =   375
      Left            =   2400
      TabIndex        =   7
      Text            =   "Text4"
      Top             =   2760
      Width           =   1815
   End
   Begin VB.TextBox Text3 
      Height          =   375
      Left            =   2400
      TabIndex        =   6
      Text            =   "Text3"
      Top             =   2160
      Width           =   1815
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   2400
      TabIndex        =   5
      Text            =   "D:\matlab 文档\光盘使用说明1.doc"
      Top             =   1560
      Width           =   1815
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   2400
      TabIndex        =   4
      Text            =   "D:\matlab 文档\光盘使用说明.doc"
      Top             =   960
      Width           =   1815
   End
   Begin VB.CommandButton Command3 
      Caption         =   "Command3"
      Height          =   375
      Left            =   0
      TabIndex        =   2
      Top             =   3360
      Width           =   1695
   End
   Begin VB.CommandButton Command2 
      Caption         =   "Command2"
      Height          =   375
      Left            =   2040
      TabIndex        =   1
      Top             =   3360
      Width           =   1695
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   375
      Left            =   3960
      TabIndex        =   0
      Top             =   3360
      Width           =   1695
   End
   Begin VB.Label Label5 
      Caption         =   "压缩比"
      Height          =   375
      Left            =   720
      TabIndex        =   11
      Top             =   2760
      Width           =   1215
   End
   Begin VB.Label Label4 
      Caption         =   "解压后文件目录"
      Height          =   255
      Left            =   720
      TabIndex        =   10
      Top             =   2280
      Width           =   1575
   End
   Begin VB.Label Label3 
      Caption         =   "目标文件"
      Height          =   255
      Left            =   720
      TabIndex        =   9
      Top             =   1680
      Width           =   1455
   End
   Begin VB.Label Label2 
      Caption         =   "待压缩文件"
      Height          =   375
      Left            =   720
      TabIndex        =   8
      Top             =   960
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "Label1"
      Height          =   495
      Left            =   2280
      TabIndex        =   3
      Top             =   120
      Width           =   2175
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private WithEvents ObjZip As ClassZip
Attribute ObjZip.VB_VarHelpID = -1
Private BgTime As Single
Private Sub Command1_Click()
    BgTime = Timer
    Command1.Enabled = False
    Command2.Enabled = False
    With ObjZip
    .InputFileName = Text1.Text
    .OutputFileName = Text2.Text
    .IsCompress = True
    .CompressLevel = Val(Text4.Text)
    .BeginProcss
    End With
    Label1.Caption = Round(Timer - BgTime, 2) & "秒"
    Command1.Enabled = True
    Command2.Enabled = True
End Sub
Private Sub Command2_Click()
    BgTime = Timer
    Command1.Enabled = False
    Command2.Enabled = False
    With ObjZip
    .InputFileName = Text2.Text
    .OutputFileName = Text3.Text
    .IsCompress = False
    .BeginProcss
    End With
    Label1 = Round(Timer - BgTime, 2) & "秒"
    Command1.Enabled = True
    Command2.Enabled = True
End Sub
Private Sub Command3_Click()
    ObjZip.CancelProcss = True
End Sub

Private Sub Form_Load()
    Set ObjZip = New ClassZip
    Command1.Caption = "压缩"
    Command2.Caption = "解压"
    Command3.Caption = "中断"
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Set ObjZip = Nothing
End Sub

Private Sub ObjZip_FileProgress(sngPercentage As Single)
    Label1 = Int(sngPercentage * 100) & "%"
End Sub

Private Sub ObjZip_ProcssError(ErrorDescription As String)
    MsgBox ErrorDescription
End Sub


⌨️ 快捷键说明

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