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

📄 frmsorttest.vb

📁 排序的测试 程序 数据结构 实现程序
💻 VB
字号:
Imports System.Threading

Public Class frmSortTest
    Inherits System.Windows.Forms.Form

#Region " Windows 窗体设计器生成的代码 "

    Public Sub New()
        MyBase.New()

        '该调用是 Windows 窗体设计器所必需的。
        InitializeComponent()

        '在 InitializeComponent() 调用之后添加任何初始化

    End Sub

    '窗体重写 dispose 以清理组件列表。
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Windows 窗体设计器所必需的
    Private components As System.ComponentModel.IContainer

    '注意: 以下过程是 Windows 窗体设计器所必需的
    '可以使用 Windows 窗体设计器修改此过程。
    '不要使用代码编辑器修改它。
    Friend WithEvents QuickSort As SortAlogrithm.SortTestPanel
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents SelectSort As SortAlogrithm.SortTestPanel
    Friend WithEvents InsertSort As SortAlogrithm.SortTestPanel
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents BubbleSort As SortAlogrithm.SortTestPanel
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents btnInit As System.Windows.Forms.Button
    Friend WithEvents btnSort As System.Windows.Forms.Button
    Friend WithEvents btnQuick As System.Windows.Forms.Button
    Friend WithEvents btnSelect As System.Windows.Forms.Button
    Friend WithEvents btnInsert As System.Windows.Forms.Button
    Friend WithEvents btnBubble As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.QuickSort = New SortAlogrithm.SortTestPanel
        Me.Label1 = New System.Windows.Forms.Label
        Me.Label2 = New System.Windows.Forms.Label
        Me.SelectSort = New SortAlogrithm.SortTestPanel
        Me.InsertSort = New SortAlogrithm.SortTestPanel
        Me.Label3 = New System.Windows.Forms.Label
        Me.BubbleSort = New SortAlogrithm.SortTestPanel
        Me.Label4 = New System.Windows.Forms.Label
        Me.btnInit = New System.Windows.Forms.Button
        Me.btnSort = New System.Windows.Forms.Button
        Me.btnQuick = New System.Windows.Forms.Button
        Me.btnSelect = New System.Windows.Forms.Button
        Me.btnInsert = New System.Windows.Forms.Button
        Me.btnBubble = New System.Windows.Forms.Button
        Me.SuspendLayout()
        '
        'QuickSort
        '
        Me.QuickSort.Location = New System.Drawing.Point(8, 24)
        Me.QuickSort.Name = "QuickSort"
        Me.QuickSort.Size = New System.Drawing.Size(100, 216)
        Me.QuickSort.TabIndex = 0
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(8, 8)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(96, 16)
        Me.Label1.TabIndex = 2
        Me.Label1.Text = "快速排序:"
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(120, 8)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(96, 16)
        Me.Label2.TabIndex = 3
        Me.Label2.Text = "选择排序:"
        '
        'SelectSort
        '
        Me.SelectSort.Location = New System.Drawing.Point(120, 24)
        Me.SelectSort.Name = "SelectSort"
        Me.SelectSort.Size = New System.Drawing.Size(100, 216)
        Me.SelectSort.TabIndex = 4
        '
        'InsertSort
        '
        Me.InsertSort.Location = New System.Drawing.Point(232, 24)
        Me.InsertSort.Name = "InsertSort"
        Me.InsertSort.Size = New System.Drawing.Size(100, 216)
        Me.InsertSort.TabIndex = 5
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(232, 8)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(96, 16)
        Me.Label3.TabIndex = 6
        Me.Label3.Text = "插入排序:"
        '
        'BubbleSort
        '
        Me.BubbleSort.Location = New System.Drawing.Point(344, 24)
        Me.BubbleSort.Name = "BubbleSort"
        Me.BubbleSort.Size = New System.Drawing.Size(100, 216)
        Me.BubbleSort.TabIndex = 7
        '
        'Label4
        '
        Me.Label4.Location = New System.Drawing.Point(344, 8)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(96, 16)
        Me.Label4.TabIndex = 8
        Me.Label4.Text = "冒泡排序:"
        '
        'btnInit
        '
        Me.btnInit.Location = New System.Drawing.Point(288, 304)
        Me.btnInit.Name = "btnInit"
        Me.btnInit.Size = New System.Drawing.Size(72, 24)
        Me.btnInit.TabIndex = 9
        Me.btnInit.Text = "初始化"
        '
        'btnSort
        '
        Me.btnSort.Location = New System.Drawing.Point(368, 304)
        Me.btnSort.Name = "btnSort"
        Me.btnSort.Size = New System.Drawing.Size(72, 24)
        Me.btnSort.TabIndex = 10
        Me.btnSort.Text = "排序"
        '
        'btnQuick
        '
        Me.btnQuick.Location = New System.Drawing.Point(16, 248)
        Me.btnQuick.Name = "btnQuick"
        Me.btnQuick.Size = New System.Drawing.Size(80, 24)
        Me.btnQuick.TabIndex = 11
        Me.btnQuick.Text = "Sort"
        '
        'btnSelect
        '
        Me.btnSelect.Location = New System.Drawing.Point(128, 248)
        Me.btnSelect.Name = "btnSelect"
        Me.btnSelect.Size = New System.Drawing.Size(80, 24)
        Me.btnSelect.TabIndex = 12
        Me.btnSelect.Text = "Sort"
        '
        'btnInsert
        '
        Me.btnInsert.Location = New System.Drawing.Point(240, 248)
        Me.btnInsert.Name = "btnInsert"
        Me.btnInsert.Size = New System.Drawing.Size(80, 24)
        Me.btnInsert.TabIndex = 13
        Me.btnInsert.Text = "Sort"
        '
        'btnBubble
        '
        Me.btnBubble.Location = New System.Drawing.Point(352, 248)
        Me.btnBubble.Name = "btnBubble"
        Me.btnBubble.Size = New System.Drawing.Size(80, 24)
        Me.btnBubble.TabIndex = 14
        Me.btnBubble.Text = "Sort"
        '
        'frmSortTest
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(456, 342)
        Me.Controls.Add(Me.btnBubble)
        Me.Controls.Add(Me.btnInsert)
        Me.Controls.Add(Me.btnSelect)
        Me.Controls.Add(Me.btnQuick)
        Me.Controls.Add(Me.btnSort)
        Me.Controls.Add(Me.btnInit)
        Me.Controls.Add(Me.Label4)
        Me.Controls.Add(Me.BubbleSort)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.InsertSort)
        Me.Controls.Add(Me.SelectSort)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.QuickSort)
        Me.Name = "frmSortTest"
        Me.Text = "SortTest"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub btnInit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInit.Click
        Me.QuickSort.Init()
        Me.SelectSort.Init()
        Me.InsertSort.Init()
        Me.BubbleSort.Init()
    End Sub

    Private Sub QuickSortBegin()
        Me.QuickSort.Begin("Quick")
    End Sub

    Private Sub SelectSortBegin()
        Me.SelectSort.Begin("Select")
    End Sub

    Private Sub InsertSortBegin()
        Me.InsertSort.Begin("Insert")
    End Sub

    Private Sub BubbleSortBegin()
        Me.BubbleSort.Begin("Bubble")
    End Sub

    Private Sub btnSort_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSort.Click
        Dim t1, t2, t3, t4 As Thread
        t1 = New Thread(New ThreadStart(AddressOf QuickSortBegin))
        t2 = New Thread(New ThreadStart(AddressOf SelectSortBegin))
        t3 = New Thread(New ThreadStart(AddressOf InsertSortBegin))
        t4 = New Thread(New ThreadStart(AddressOf BubbleSortBegin))
        t4.Start()
        t3.Start()
        t2.Start()
        t1.Start()
    End Sub

    Private Sub btnQuick_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuick.Click
        Me.QuickSort.Init()
        Me.QuickSort.Begin("Quick")
    End Sub

    Private Sub btnSelect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelect.Click
        Me.SelectSort.Init()
        Me.SelectSort.Begin("Select")
    End Sub

    Private Sub btnInsert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInsert.Click
        Me.InsertSort.Init()
        Me.InsertSort.Begin("Insert")
    End Sub

    Private Sub btnBubble_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBubble.Click
        Me.BubbleSort.Init()
        Me.BubbleSort.Begin("Bubble")
    End Sub
End Class

⌨️ 快捷键说明

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