📄 form1.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 5280
ClientLeft = 60
ClientTop = 450
ClientWidth = 7725
LinkTopic = "Form1"
ScaleHeight = 5280
ScaleWidth = 7725
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command4
Caption = "解码"
BeginProperty Font
Name = "华文细黑"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 3720
TabIndex = 4
Top = 360
Width = 1215
End
Begin VB.CommandButton Command3
Caption = "重置"
BeginProperty Font
Name = "华文细黑"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 5280
TabIndex = 3
Top = 360
Width = 1335
End
Begin VB.CommandButton Command2
Caption = "行程编码"
BeginProperty Font
Name = "华文细黑"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 2040
TabIndex = 2
Top = 360
Width = 1335
End
Begin VB.TextBox Text3
Height = 3375
Left = 360
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 1
Top = 1560
Width = 6855
End
Begin VB.CommandButton Command1
Caption = "打开文件"
BeginProperty Font
Name = "华文细黑"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 360
TabIndex = 0
Top = 360
Width = 1215
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 1440
Top = 840
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim string1(10000) As String
Dim i As Integer
Dim i1 As Integer
Dim allong As Integer
Dim first As Integer
Dim result As Double
Private Sub Command1_Click()
i = 1
CommonDialog1.Filter = "文本文件(*.txt)|*txt"
CommonDialog1.Action = 1
Imagem = CommonDialog1.FileName
If Imagem = "" Then Exit Sub
Command2.Enabled = True
Open Imagem For Binary As #1
whole& = LOF(1) \ 200 'number of whole 10,000 byte chunks
part& = LOF(1) Mod 200 'remaining bytes at end of file
buffer1$ = String$(200, 0)
start& = 1
For X& = 1 To whole& 'this for-next loop will get 10,000
Get #1, start&, buffer1$ 'byte chunks at a time.
Text3.Text = Text3.Text + buffer1$
string1(i) = buffer1$
i = i + 1
start& = start& + 200
Next
buffer1$ = String$(part&, 0)
Get #1, start&, buffer1$
Text3.Text = Text3.Text + buffer1$
string1(i) = buffer1$
'MsgBox "文件已读出"
Close #1
Form1.Refresh
End Sub
Private Sub Command2_Click()
Dim aa As Integer
Dim a1, a2 As String
Dim j, p, q, s As Integer
Dim string2(10000) As String
Dim string3(10000) As Integer
Dim c As Integer
k = 1
p = 0
aa = i
For i = 1 To aa
For j = 1 To 200
a1 = Mid(string1(i), j, 1)
a2 = Mid(string1(i), j + 1, 1)
If a1 = a2 Then
p = p + 1
Else
q = p + 1
p = 0
End If
If p = 0 Then
string2(k) = a1
string3(k) = q
k = k + 1
End If
Next
first = first + Len(string1(i))
Next
Form2.Show
Form2.Visible = False
frmWaiting.Show
frmWaiting.Refresh
Form2.Text1.Text = ""
Me.MousePointer = 11
For i = 1 To k - 1
Form2.Text1.Text = Form2.Text1.Text + string2(i)
c = string3(i)
Form2.Text1.Text = Form2.Text1.Text & c
c = Len(c) + Len(string2(i))
allong = allong + c
s = k
k = k / 5
If k = 0 Then
k = s
Else
k = k * 5
End If
If frmWaiting.ProgressBar1.Value < 100 Then
frmWaiting.ProgressBar1.Value = i / k * 100
End If
Next
Me.MousePointer = 1
frmWaiting.Hide
Form2.Visible = True
If allong < first Then
result = allong * 100 / first
MsgBox "与原文件相比压缩率为" & result & "%", vbOKOnly + vbInformation, "压缩情况"
End If
Command4.Enabled = True
End Sub
Private Sub Command3_Click()
Unload frmWaiting
Unload Form2
Unload Form3
Unload Me
Me.Show
End Sub
Private Sub Command4_Click()
Dim stringunfold As String
stringunfold = Form2.Text1.Text
stringunfold = Text3.Text
Form3.Text1.Text = stringunfold
Form3.Show
MsgBox "解码成功!!!", vbOKOnly + vbInformation, "解码情况"
End Sub
Private Sub Form_Load()
Command2.Enabled = False
Command4.Enabled = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
Unload Form3
Unload Form2
Unload frmWaiting
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -