以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]ListView显示不出文件夹图标  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=161310)

--  作者:2425004926
--  发布时间:2021/3/12 17:03:00
--  [求助]ListView显示不出文件夹图标
我用ListView显示文件夹图标,为何显示不出来,“ProjectPath & "Attachments\\”底下全部是文件夹,在Images文件夹下有个file.jpg图片,用来显示文件夹的图标



图片点击可在新窗口打开查看此主题相关图片如下:1615539294(1).png
图片点击可在新窗口打开查看

Dim lvw As WinForm.ListView = e.Form.Controls("ListView1")
lvw.AllowEdit = True \'允许编辑标题
lvw.Rows.Clear() \'清除原来的行
lvw.Images.Clear() \'清除原来的图片
lvw.StopRedraw() \'暂停绘制
Dim file As String
For Each dir As String In FileSys.GetDirectories(ProjectPath & "Attachments\\")
    file = FileSys.GetName(dir)
    lvw.View = ViewMode.LargeIcon \'显示模式为大图标
    lvw.Images.LargeSize = New Size(80,80) \'定义大图标尺寸
    lvw.Images.AddLargeImage(file,ProjectPath & "Images\\file.jpg") \'添加代表这个图片的大图标,第一个为键值,第二个为对应的照片
    Dim r As  WinForm.ListViewRow =  lvw.Rows.Add() \'增加一行
    r.Text = b \'指定标题

    r.ImageKey = ProjectPath & "Images\\file.jpg"
Next
lvw.ResumeRedraw() \'恢复绘制

--  作者:有点蓝
--  发布时间:2021/3/12 17:08:00
--  
r.ImageKey = file 

[此贴子已经被作者于2021/3/12 17:08:02编辑过]

--  作者:2425004926
--  发布时间:2021/3/12 17:13:00
--  
 OK,谢谢!