Private Enum IconValues
iconUnchecked = 1
iconChecked = 2
End Enum
Private Sub Form_Load()
Dim i As Integer
' Associate ImageList1 with the ListView's
' small icons.
ListView1.SmallIcons = ImageList1
ListView1.View = lvwList
ListView1.LabelWrap = False
' Make some list items and set their
' SmallIcons to the unchecked icon.
For i = 1 To 10
ListView1.ListItems.Add , , "Item " & Format$(i), , _
iconUnchecked
Next i
End Sub
' Toggle the item's checked state.
Private Sub ListView1_ItemClick(ByVal Item As ListItem)
With Item
If .SmallIcon = 1 Then
.SmallIcon = 2
Else
.SmallIcon = 1
End If
End With
End Sub
|