📄 frmlistview.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmListView
Caption = "ListView Control"
ClientHeight = 3792
ClientLeft = 168
ClientTop = 456
ClientWidth = 8040
Icon = "frmListView.frx":0000
LinkTopic = "Form1"
ScaleHeight = 3792
ScaleWidth = 8040
StartUpPosition = 1 'CenterOwner
Begin VB.Frame fraAddNew
Caption = "Add a Name"
Height = 3375
Left = 5280
TabIndex = 8
Top = 240
Width = 2175
Begin VB.CommandButton cmdAdd
Caption = "&Add"
Default = -1 'True
Height = 495
Left = 480
TabIndex = 6
Top = 2640
Width = 1215
End
Begin VB.TextBox txtFirst
Height = 375
Left = 240
TabIndex = 3
Top = 1320
Width = 1695
End
Begin VB.TextBox txtPhone
Height = 375
Left = 240
TabIndex = 5
Top = 2040
Width = 1695
End
Begin VB.TextBox txtLast
Height = 375
Left = 240
TabIndex = 1
Top = 600
Width = 1695
End
Begin VB.Label Label3
Caption = "Phone"
Height = 255
Left = 120
TabIndex = 4
Top = 1800
Width = 975
End
Begin VB.Label Label2
Caption = "First"
Height = 255
Left = 120
TabIndex = 2
Top = 1080
Width = 1095
End
Begin VB.Label Label1
Caption = "Last"
Height = 255
Left = 120
TabIndex = 0
Top = 360
Width = 1215
End
End
Begin MSComctlLib.ImageList ilsSmallIcons
Left = 240
Top = 3120
_ExtentX = 995
_ExtentY = 995
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 1
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmListView.frx":0442
Key = "Person"
EndProperty
EndProperty
End
Begin MSComctlLib.ImageList ilsLargeIcons
Left = 840
Top = 3120
_ExtentX = 995
_ExtentY = 995
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 1
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmListView.frx":0896
Key = "Person"
EndProperty
EndProperty
End
Begin MSComctlLib.ListView lvwPersons
Height = 2652
Left = 240
TabIndex = 7
Top = 480
Width = 4452
_ExtentX = 7853
_ExtentY = 4678
LabelWrap = -1 'True
HideSelection = -1 'True
_Version = 393217
Icons = "ilsLargeIcons"
SmallIcons = "ilsSmallIcons"
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 3
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Text = "LastName"
Object.Width = 2540
EndProperty
BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 1
Text = "First Name"
Object.Width = 2540
EndProperty
BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 2
Text = "Phone"
Object.Width = 2540
EndProperty
End
Begin VB.Label lblView
Caption = "Large Icons"
BeginProperty Font
Name = "MS Sans Serif"
Size = 7.8
Charset = 0
Weight = 700
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 360
TabIndex = 9
Top = 120
Width = 2775
End
Begin VB.Menu mnuFile
Caption = "&File"
Begin VB.Menu mnuFileExit
Caption = "E&xit"
End
End
Begin VB.Menu mnuView
Caption = "&View"
Begin VB.Menu mnuViewLarge
Caption = "Large &Icons"
End
Begin VB.Menu mnuViewSmall
Caption = "&Small Icons"
End
Begin VB.Menu mnuViewList
Caption = "&List"
End
Begin VB.Menu mnuViewDetails
Caption = "&Details"
End
End
End
Attribute VB_Name = "frmListView"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Project: ListView
'Programmer: Bradley/Millspaugh
'Date: 2/2000
'Description: Demonstrate a ListView control
'Folder: Ch02ListView
Option Explicit
Private Sub cmdAdd_Click()
'Add a new item to the list
Dim itmNew As ListItem
If txtLast.Text <> "" Then
Set itmNew = lvwPersons.ListItems.Add(, , txtLast.Text, "Person", "Person")
With itmNew.ListSubItems
.Add , , txtFirst.Text
.Add , , txtPhone.Text
End With
txtLast.Text = ""
txtFirst.Text = ""
txtPhone.Text = ""
txtLast.SetFocus
End If
End Sub
Private Sub Form_Load()
'Add elements to the ListView
Dim itmNew As ListItem
'Note: Usually You would read data from a database
Set itmNew = lvwPersons.ListItems.Add(1, , "Beeson", "Person", "Person")
With itmNew.ListSubItems
.Add , , "Janice"
.Add , , "(805) 555-1212"
End With
Set itmNew = lvwPersons.ListItems.Add(1, , "Mills", "Person", "Person")
With itmNew.ListSubItems
.Add , , "Pat"
.Add , , "(818) 555-4444"
End With
lvwPersons.Sorted = True
End Sub
Private Sub mnuFileExit_Click()
'Terminate the project
Unload Me
End Sub
Private Sub mnuViewDetails_Click()
'Set the View to Report
lvwPersons.View = lvwReport
lblView.Caption = "Report"
End Sub
Private Sub mnuViewLarge_Click()
'Set the View to large icon
lvwPersons.View = lvwIcon
lblView.Caption = "Icon"
End Sub
Private Sub mnuViewList_Click()
'Set the View to List
lvwPersons.View = lvwList
lblView.Caption = "List"
End Sub
Private Sub mnuViewSmall_Click()
'Set the View to small icons
lvwPersons.View = lvwSmallIcon
lblView.Caption = "Small Icon"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -