📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Demonstrating class CList"
ClientHeight = 2985
ClientLeft = 60
ClientTop = 345
ClientWidth = 3495
LinkTopic = "Form1"
ScaleHeight = 2985
ScaleWidth = 3495
StartUpPosition = 3 'Windows Default
Begin VB.ListBox lstOutput
Height = 1425
ItemData = "Form1.frx":0000
Left = 0
List = "Form1.frx":0002
TabIndex = 6
Top = 1560
Width = 3495
End
Begin VB.CommandButton cmdRemoveBack
Caption = "Remove from back"
Height = 375
Left = 1800
TabIndex = 5
Top = 1080
Width = 1695
End
Begin VB.CommandButton cmdRemoveFront
Caption = "Remove from front"
Height = 375
Left = 0
TabIndex = 4
Top = 1080
Width = 1695
End
Begin VB.CommandButton cmdInsertFront
Caption = "Insert at front"
Height = 375
Left = 0
TabIndex = 3
Top = 600
Width = 1695
End
Begin VB.CommandButton cmdInsertBack
Caption = "Insert at back"
Height = 375
Left = 1800
TabIndex = 2
Top = 600
Width = 1695
End
Begin VB.TextBox txtInput
Height = 285
Left = 0
TabIndex = 0
Top = 240
Width = 3495
End
Begin VB.Label lblInput
Caption = "Enter value to insert"
Height = 255
Left = 0
TabIndex = 1
Top = 0
Width = 2655
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Fig. 21.3
' Demonstrating class CList
Option Explicit
Dim list As New CList
Private Sub cmdInsertFront_Click()
Call list.InsertAtFront(txtInput.Text)
Call Display
End Sub
Private Sub cmdInsertBack_Click()
Call list.InsertAtBack(txtInput.Text)
Call Display
End Sub
Private Sub cmdRemoveFront_Click()
txtInput.Text = ""
Call list.RemoveFromFront
Call Display
End Sub
Private Sub cmdRemoveBack_Click()
txtInput.Text = ""
Call list.RemoveFromBack
Call Display
End Sub
Private Sub Display()
Dim elements As New CListIterator
Call lstOutput.Clear
Set elements = list.Iterator
If elements.HasMoreItems = False Then
Call lstOutput.AddItem("The list 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 + -