📄 demo.frm
字号:
VERSION 5.00
Begin VB.Form frmDemo
BorderStyle = 1 'Fixed Single
Caption = "QuickSort Demonstration"
ClientHeight = 6555
ClientLeft = 2715
ClientTop = 1320
ClientWidth = 7155
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
PaletteMode = 1 'UseZOrder
ScaleHeight = 6555
ScaleWidth = 7155
Begin VB.TextBox txtSorted
BeginProperty Font
Name = "Courier New"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1740
Left = 75
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 15
Top = 3120
Width = 6915
End
Begin VB.TextBox txtUnsorted
BeginProperty Font
Name = "Courier New"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1755
Left = 75
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 14
Top = 900
Width = 6915
End
Begin VB.CommandButton cmdCreate
Caption = "Create Data"
Height = 400
Left = 5685
TabIndex = 13
Top = 5040
Width = 1275
End
Begin VB.Frame Frame2
Height = 1290
Left = 4200
TabIndex = 9
Top = 5040
Width = 1365
Begin VB.OptionButton optNo
Caption = "No"
Height = 240
Left = 300
TabIndex = 12
Top = 900
Value = -1 'True
Width = 990
End
Begin VB.OptionButton optYes
Caption = "Yes"
Height = 240
Left = 300
TabIndex = 11
Top = 600
Width = 765
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "Remove Dupes"
Height = 240
Left = 75
TabIndex = 10
Top = 225
Width = 1290
End
End
Begin VB.CommandButton cmdExit
Caption = "Exit"
Height = 400
Left = 5685
TabIndex = 8
Top = 6000
Width = 1275
End
Begin VB.CommandButton cmdSort
Caption = "Sort Data"
Height = 400
Left = 5685
TabIndex = 7
Top = 5520
Width = 1275
End
Begin VB.Frame Frame1
Height = 1290
Left = 2760
TabIndex = 2
Top = 5040
Width = 1290
Begin VB.OptionButton optNumeric
Caption = "Numeric"
Height = 315
Left = 225
TabIndex = 5
Top = 900
Value = -1 'True
Width = 990
End
Begin VB.OptionButton optString
Caption = "String"
Height = 315
Left = 225
TabIndex = 4
Top = 600
Width = 915
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "Select the type of data to sort"
Height = 390
Left = 75
TabIndex = 3
Top = 150
Width = 1215
End
End
Begin VB.Label lblSortTime
BackStyle = 0 'Transparent
Height = 315
Left = 75
TabIndex = 17
Top = 5100
Width = 2565
End
Begin VB.Label lblComments
BackStyle = 0 'Transparent
Caption = "Written by Kenneth Ives"
BeginProperty Font
Name = "Times New Roman"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 780
Left = 225
TabIndex = 16
Top = 5475
Width = 2475
End
Begin VB.Label Label4
Alignment = 2 'Center
BackColor = &H00800000&
BorderStyle = 1 'Fixed Single
Caption = "For demo purposes, we are only using 1000 items."
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 360
Left = 120
TabIndex = 6
Top = 240
Width = 6855
End
Begin VB.Label Label2
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "Sorted data"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 75
TabIndex = 1
Top = 2880
Width = 6915
End
Begin VB.Label Label1
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "Unsorted data"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 75
TabIndex = 0
Top = 675
Width = 6915
End
End
Attribute VB_Name = "frmDemo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
' ---------------------------------------------------------
' Shell sort demo
' Author: Kenneth Ives kenives@cmpu.net
'
' This is freeware. Use as you see fit.
' Compiled with VB 5.0 (Sp3)
'
' If you do not want to use a list box to do your sorting
' then use this sort routine.
'
' NOTE: It averages about 30-60 seconds to sort and remove
' the dupes from 10,000 items (depending on the number
' of duplicate items. However, it only takes about
' 3-6 seconds without removing the dupes.
' ---------------------------------------------------------
Const MAXSIZE = 1000
Private tstAray(1 To MAXSIZE) As String
Private Function BuildThreeCharStr() As String
' ------------------------------------------------
' Define variables
' ------------------------------------------------
Dim n As Integer
Dim iTmpNum As Integer
Dim sTmpChar As String
' ------------------------------------------------
' Initialize variables
' ------------------------------------------------
n = 0
iTmpNum = 0
sTmpChar = ""
' ------------------------------------------------
' Seed the random generator with the number of
' seconds that have elapsed since midnight
' ------------------------------------------------
Randomize Timer
' ------------------------------------------------
' Loop until we have created three printable
' characters
' ------------------------------------------------
Do
iTmpNum = Int((90 * Rnd) + 1)
Select Case iTmpNum
'
' we want A-Z (Uppercase only)
Case 65 To 90
' convert the the decimal value to ASCII text
sTmpChar = sTmpChar & Chr(iTmpNum)
' increment character count
n = n + 1
Case Else
' Try again
End Select
Loop Until n = 3
' ------------------------------------------------
' Return the three character group
' ------------------------------------------------
BuildThreeCharStr = sTmpChar
End Function
Private Function BuildThreeNumbers() As String
' ------------------------------------------------
' Define variables
' ------------------------------------------------
Dim sNumStr As String
' ------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -