📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Demonstrating class CQueue"
ClientHeight = 3120
ClientLeft = 60
ClientTop = 345
ClientWidth = 3975
LinkTopic = "Form1"
ScaleHeight = 3120
ScaleWidth = 3975
StartUpPosition = 3 'Windows Default
Begin VB.TextBox txtPush
Height = 285
Left = 1440
TabIndex = 3
Top = 105
Width = 975
End
Begin VB.CommandButton cmdEnqueue
Caption = "Value to enqueue"
Height = 285
Left = 2520
TabIndex = 2
Top = 105
Width = 1455
End
Begin VB.CommandButton cmdDequeue
Caption = "Dequeue value"
Height = 285
Left = 0
TabIndex = 1
Top = 840
Width = 1695
End
Begin VB.ListBox lstOutput
Height = 1815
ItemData = "Form1.frx":0000
Left = 0
List = "Form1.frx":0002
TabIndex = 0
Top = 1320
Width = 3975
End
Begin VB.Line Line1
X1 = 0
X2 = 3960
Y1 = 600
Y2 = 600
End
Begin VB.Label lblEnqueue
Alignment = 1 'Right Justify
Caption = "Value to enqueue:"
Height = 255
Left = 0
TabIndex = 5
Top = 120
Width = 1335
End
Begin VB.Label lblDequeue
Height = 255
Left = 1800
TabIndex = 4
Top = 855
Width = 2055
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Fig. 21.11
' Demonstrating class CQueue
Option Explicit
Dim mQueue As New CQueue
Private Sub cmdEnqueue_Click()
mQueue.Enqueue (txtPush.Text)
Call Display
End Sub
Private Sub cmdDequeue_Click()
lblDequeue.Caption = "Dequeued: " & mQueue.Dequeue()
Call Display
End Sub
Private Sub Display()
Dim elements As New CListIterator
Call lstOutput.Clear
Set elements = mQueue.Iterator
If elements.HasMoreItems = False Then
Call lstOutput.AddItem("The queue is empty")
Exit Sub
End If
While elements.HasMoreItems
Call lstOutput.AddItem(elements.NextItem)
Wend
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -