以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]listview图片 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=97143) |
-- 作者:无限5180 -- 发布时间:2017/3/6 21:33:00 -- [求助]listview图片 我设置的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编辑过]
|
-- 作者:有点蓝 -- 发布时间:2017/3/6 21:47:00 -- Dim lvw As WinForm.ListView = e.Form.Controls("ListView1") lvw.Groups.Clear() \'清除原来的分组 lvw.Rows.Clear() \'清除原来的行 lvw.Images.Clear() \'清除原来的图片 lvw.View = ViewMode.SmallIcon lvw.Images.AddImage("Xm", "log.ico","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" \' \'显示模式切换为小图标,图标能显示在左侧 End If Next End If Next
|
-- 作者:无限5180 -- 发布时间:2017/3/7 0:13:00 -- 谢谢! |