📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Demonstrating class CStack"
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 = 1200
TabIndex = 3
Top = 105
Width = 1095
End
Begin VB.CommandButton cmdPush
Caption = "Push value"
Height = 285
Left = 2400
TabIndex = 2
Top = 105
Width = 1455
End
Begin VB.CommandButton cmdPop
Caption = "Pop 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 lblPush
Alignment = 1 'Right Justify
Caption = "Value to push:"
Height = 255
Left = 0
TabIndex = 5
Top = 120
Width = 1095
End
Begin VB.Label lblPop
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.9
' Demonstrating class CStack
Option Explicit
Dim mStack As New CStack
Private Sub cmdPush_Click()
mStack.Push (txtPush.Text)
Call Display
End Sub
Private Sub cmdPop_Click()
lblPop.Caption = "Popped: " & mStack.Pop()
Call Display
End Sub
Private Sub Display()
Dim elements As New CListIterator
Call lstOutput.Clear
Set elements = mStack.Iterator
If elements.HasMoreItems = False Then
Call lstOutput.AddItem("The stack 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 + -