您好,我有一个列表视图,可以打开文件夹内的项目并显示它们。我想知道是否有办法让列表视图也显示图标,可能使用 shell32 或 imagelist。这是代码:
Imports System.IO
Imports System.Xml
Imports System.Runtime.InteropServices
Imports Microsoft.VisualBasic
Public Class cv7import
Private Sub cv7import_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim caminho As String
caminho = "C:\Documents and Settings\Software\Ambiente de trabalho\1"
lstvicon.View = View.Details
lstvicon.GridLines = False
lstvicon.FullRowSelect = True
lstvicon.HideSelection = False
lstvicon.MultiSelect = True
lstvicon.Columns.Add("Nome")
lstvicon.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize)
Dim DI As System.IO.DirectoryInfo = New System.IO.DirectoryInfo(caminho)
Dim files() As System.IO.FileInfo = DI.GetFiles
Dim file As System.IO.FileInfo
Dim li As ListViewItem
For Each file In files
li = lstvicon.Items.Add(file.Name)
li.Tag = file.FullName
Next
End Sub
End Class
这是两张图片,说明它的外观以及我希望它的外观(如果有帮助的话)。
我想要什么:http: //imageshack.us/photo/my-images/21/wantd.png/