我设置的listview只能显示文字图片无法显示,请帮忙指点一下代码中哪个错了,我的代码如下:
Dim lvw As WinForm.ListView = e.Form.Controls("ListView1")
lvw.Groups.Clear() '清除原来的分组
lvw.Rows.Clear() '清除原来的行
lvw.Images.Clear() '清除原来的图片
lvw.View = ViewMode.LargeIcon '显示模式为大图标
lvw.Images.AddSmallImage("Xm", "log.ico") '添加代表项目的图标
Dim fenzu As List(of String)= DataTable("项目登记").GetValues("省市","","省市")
For Each fz As String In fenzu
If fenzu.IndexOf(fz) <> -1 Then
Dim vg As WinForm.ListViewGroup = lvw.Groups.add()
vg.Name= fz
vg.text= fz
Dim DanJ As List(of String)= DataTable("项目登记").GetValues("项目名称","省市 ='" & fz & "'","项目名称")
For Each dj As String In DanJ
If Danj.IndexOf(dj) <> -1 Then
Dim r As WinForm.ListViewRow = lvw.Rows.add()
r.Name =dj
r.Text=dj
r.Group=fz
r.ImageKey = "Xm" '
lvw.View = ViewMode.SmallIcon '显示模式切换为小图标,图标能显示在左侧
End If
Next
End If
Next
[此贴子已经被作者于2017/3/6 21:35:34编辑过]