📄 frmtest.frm
字号:
VERSION 5.00
Begin VB.Form frmTest
AutoRedraw = -1 'True
BorderStyle = 1 'Fixed Single
Caption = "LZW Compression - by Asgeir B. Ingvarsson"
ClientHeight = 4650
ClientLeft = 45
ClientTop = 330
ClientWidth = 7815
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4650
ScaleWidth = 7815
StartUpPosition = 3 'Windows Default
Begin VB.TextBox txtYourString
Height = 285
Left = 360
Locked = -1 'True
MaxLength = 80
TabIndex = 16
Text = "TxtYourString"
Top = 1005
Width = 5655
End
Begin VB.OptionButton optString
Height = 375
Index = 2
Left = 120
TabIndex = 15
Top = 960
Width = 255
End
Begin VB.CommandButton cmdExit
Caption = "&Exit"
Height = 375
Left = 6480
TabIndex = 14
Top = 1080
Width = 1215
End
Begin VB.Frame fme
Caption = "Results"
Height = 2655
Left = 120
TabIndex = 3
Top = 1800
Width = 7575
Begin VB.Label lblResult
BackColor = &H80000009&
BorderStyle = 1 'Fixed Single
Caption = "lblresult"
Height = 285
Index = 5
Left = 1920
TabIndex = 18
Top = 2160
Width = 3135
End
Begin VB.Label lblText
AutoSize = -1 'True
Caption = "Time Taken:"
Height = 195
Index = 5
Left = 240
TabIndex = 17
Top = 2160
Width = 900
End
Begin VB.Label lblResult
BackColor = &H80000009&
BorderStyle = 1 'Fixed Single
Caption = "lblresult"
Height = 285
Index = 4
Left = 1920
TabIndex = 13
Top = 1800
Width = 3135
End
Begin VB.Label lblResult
BackColor = &H80000009&
BorderStyle = 1 'Fixed Single
Caption = "lblresult"
Height = 285
Index = 3
Left = 1920
TabIndex = 12
Top = 1440
Width = 3135
End
Begin VB.Label lblResult
BackColor = &H80000009&
BorderStyle = 1 'Fixed Single
Caption = "lblresult"
Height = 285
Index = 2
Left = 1920
TabIndex = 11
Top = 1080
Width = 3135
End
Begin VB.Label lblResult
BackColor = &H80000009&
BorderStyle = 1 'Fixed Single
Caption = "lblresult"
Height = 285
Index = 1
Left = 1920
TabIndex = 10
Top = 720
Width = 5535
End
Begin VB.Label lblResult
BackColor = &H80000009&
BorderStyle = 1 'Fixed Single
Caption = "lblresult"
Height = 285
Index = 0
Left = 1920
TabIndex = 9
Top = 360
Width = 5535
End
Begin VB.Label lblText
AutoSize = -1 'True
Caption = "Compression Ratio:"
Height = 195
Index = 4
Left = 240
TabIndex = 8
Top = 1800
Width = 1365
End
Begin VB.Label lblText
AutoSize = -1 'True
Caption = "Compressed Size:"
Height = 195
Index = 3
Left = 240
TabIndex = 7
Top = 1440
Width = 1260
End
Begin VB.Label lblText
AutoSize = -1 'True
Caption = "Input Size:"
Height = 195
Index = 2
Left = 240
TabIndex = 6
Top = 1080
Width = 750
End
Begin VB.Label lblText
AutoSize = -1 'True
Caption = "Compressed String:"
Height = 195
Index = 1
Left = 240
TabIndex = 5
Top = 720
Width = 1365
End
Begin VB.Label lblText
AutoSize = -1 'True
Caption = "Input String:"
Height = 195
Index = 0
Left = 240
TabIndex = 4
Top = 360
Width = 855
End
End
Begin VB.OptionButton optString
Caption = "Repeated string of text... Repeated string of text... Repeated string of text... Repeated....."
Height = 375
Index = 1
Left = 120
TabIndex = 2
Top = 120
Width = 7095
End
Begin VB.CommandButton cmdCompress
Caption = "&Compress"
Height = 375
Left = 6480
TabIndex = 1
Top = 600
Width = 1215
End
Begin VB.OptionButton optString
Caption = "The quick brown fox jumped over the lazy dog."
Height = 495
Index = 0
Left = 120
TabIndex = 0
Top = 480
Value = -1 'True
Width = 3975
End
End
Attribute VB_Name = "frmTest"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private lSelected As Byte
Private Sub CmdCompress_Click()
Dim InputString As String
Dim CompString As String
Dim ExpString As String
Dim ElapsedTime As Single
Screen.MousePointer = vbDefault
If lSelected <> 2 Then
InputString = optString(lSelected).Caption
Else
InputString = txtYourString
End If
ElapsedTime = Timer
CompString = Deflate(InputString) 'Compress
ExpString = Inflate(CompString) 'Uncompress
lblResult(0) = ExpString
lblResult(1) = CompString
lblResult(2) = Len(ExpString)
lblResult(3) = Len(CompString)
lblResult(4) = (100 - 100 * Len(CompString) \ Len(ExpString)) & "%"
lblResult(5) = Format(Timer - ElapsedTime, "0.00") & " seconds"
Screen.MousePointer = vbDefault
End Sub
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim c As Byte
For c = 0 To lblResult.UBound
lblResult(c).Caption = ""
Next
txtYourString = "<Enter Your String Here>"
End Sub
Private Sub Form_Unload(Cancel As Integer)
End
End Sub
Private Sub optString_Click(Index As Integer)
lSelected = Index
If lSelected <> 2 Then
txtYourString.Locked = True
Else
txtYourString.Locked = False
End If
End Sub
Private Sub txtYourString_GotFocus()
With txtYourString
.SelStart = 0
.SelLength = Len(txtYourString)
End With
End Sub
Private Sub txtYourString_KeyPress(KeyAscii As Integer)
optString(2).Value = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -