📄 frmlist.frm
字号:
VERSION 5.00
Begin VB.Form frmList
Caption = "Fig. 10.22: ListBox"
ClientHeight = 3195
ClientLeft = 2760
ClientTop = 2145
ClientWidth = 4350
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4350
Begin VB.CommandButton cmdExit
Caption = "E&xit"
Height = 495
Left = 2985
TabIndex = 5
Top = 2400
Width = 1215
End
Begin VB.CommandButton cmdClear
Caption = "&Clear"
Height = 495
Left = 2985
TabIndex = 4
Top = 1800
Width = 1215
End
Begin VB.CommandButton cmdRemove
Caption = "&Remove"
Height = 495
Left = 2985
TabIndex = 3
Top = 1200
Width = 1215
End
Begin VB.CommandButton cmdAdd
Caption = "&Add"
Height = 495
Left = 2985
TabIndex = 1
Top = 600
Width = 1215
End
Begin VB.TextBox txtInput
Height = 360
Left = 2985
TabIndex = 0
Top = 135
Width = 1215
End
Begin VB.ListBox lstList
Height = 2790
Left = 105
Sorted = -1 'True
TabIndex = 2
Top = 105
Width = 2415
End
End
Attribute VB_Name = "frmList"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Fig. 10.22
' Demonstrating the ListBox control
Option Explicit ' General declaration
Private Sub cmdAdd_Click()
Call lstList.AddItem(txtInput.Text) ' Add Text to ListBox
txtInput.Text = "" ' Clear TextBox
End Sub
Private Sub cmdRemove_Click()
' If an item is selected then delete it
If lstList.ListIndex <> -1 Then
Call lstList.RemoveItem(lstList.ListIndex)
End If
End Sub
Private Sub cmdClear_Click()
Call lstList.Clear ' Remove all list items
End Sub
Private Sub cmdExit_Click()
End ' Terminate execution
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -