📄 lz78.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 7140
ClientLeft = 3600
ClientTop = 3180
ClientWidth = 6945
LinkTopic = "Form1"
ScaleHeight = 7140
ScaleWidth = 6945
Begin VB.TextBox Text3
Height = 375
Left = 2040
TabIndex = 11
Text = "Text3"
Top = 5040
Width = 3255
End
Begin VB.ListBox List3
Height = 2400
ItemData = "lz78.frx":0000
Left = 4440
List = "lz78.frx":0002
TabIndex = 8
Top = 1680
Width = 855
End
Begin VB.ListBox List2
Height = 2400
ItemData = "lz78.frx":0004
Left = 3000
List = "lz78.frx":0006
TabIndex = 7
Top = 1680
Width = 1215
End
Begin VB.ListBox List1
Height = 2400
ItemData = "lz78.frx":0008
Left = 1680
List = "lz78.frx":000A
TabIndex = 6
Top = 1680
Width = 1095
End
Begin VB.CommandButton Command4
Caption = "清空字典"
Height = 375
Left = 3480
TabIndex = 5
Top = 6000
Width = 1095
End
Begin VB.CommandButton Command3
Caption = "重 构"
Height = 375
Left = 1800
TabIndex = 4
Top = 6000
Width = 1215
End
Begin VB.TextBox Text2
Height = 375
Left = 2040
MaxLength = 500
TabIndex = 3
Text = "Text2"
Top = 4440
Width = 3255
End
Begin VB.CommandButton Command2
Caption = "退 出"
Height = 375
Left = 5160
TabIndex = 2
Top = 6000
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "编 码"
Height = 375
Left = 360
TabIndex = 1
Top = 6000
Width = 1095
End
Begin VB.TextBox Text1
Height = 375
Left = 1920
MaxLength = 500
TabIndex = 0
Text = "Text1"
Top = 600
Width = 3255
End
Begin VB.Label Label3
Caption = "压缩比"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 840
TabIndex = 12
Top = 5040
Width = 735
End
Begin VB.Label Label2
Caption = "重构显示"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 840
TabIndex = 10
Top = 4440
Width = 975
End
Begin VB.Label Label1
Caption = " 原 码"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 960
TabIndex = 9
Top = 720
Width = 735
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim num As Integer
Dim d(30, 4) As String
Dim p As String
Private Sub Command1_Click()
Dim a As Integer, b As Integer, k As Integer, output As Integer
Dim code As String
Dim c As String
output = 0
p = ""
num = 1
code = Trim(Text1.Text)
a = Len(code)
If a > 0 Then
For i = 1 To 30
c = Mid(code, i, 1)
p = p + c
k = 0
For j = 1 To 30
If StrComp(p, d(j, 2)) = 0 Then
k = 1
output = j
End If
Next j
If k <> 1 Then
d(num, 1) = num
d(num, 2) = p
d(num, 3) = output
d(num, 4) = c
p = ""
output = 0
num = num + 1
End If
Next i
For i = 1 To num
List1.AddItem d(i, 1)
List2.AddItem d(i, 2)
List3.AddItem d(i, 3) & d(i, 4)
Next i
Text3.Text = (a * 2) / ((num - 1) * 3) & ":1"
Else
MsgBox "请输入原码", 48, "请确认"
End If
End Sub
Private Sub Command2_Click()
Unload Form1
Unload Form2
End Sub
Private Sub Command3_Click()
Dim h(30, 4) As String
Dim cd As String
cd = ""
For i = 1 To num
For j = 1 To 4
h(i, j) = d(i, j)
Next j
Next i
For k = 1 To 30
cd = cd & h(Val(d(k, 3)), 2) & h(k, 4)
Next k
cd = cd & p
Text2.Text = cd
End Sub
Private Sub Command4_Click()
List1.Clear
List2.Clear
List3.Clear
For i = 1 To num
For j = 1 To 4
d(i, j) = ""
Next j
Next i
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
List1.AddItem "位置"
List2.AddItem "字典"
List3.AddItem "输出"
End Sub
Private Sub Form_Load()
List1.AddItem "位置"
List2.AddItem "字典"
List3.AddItem "输出"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -