永发信息网

C#Windows 如何从imagelist中读取图片向Listview里循环添加图片

答案:1  悬赏:30  手机版
解决时间 2021-02-22 11:50
  • 提问者网友:欲望失宠
  • 2021-02-22 00:08
C#Windows 如何从imagelist中读取图片向Listview里循环添加图片
最佳答案
  • 五星知识达人网友:话散在刀尖上
  • 2021-02-22 01:02
ListView有LargeImageList属性,你指定这个属性为特定的Imagelist,就可以使用其中的图片。
在向listView添加新项时候,只要指定新项的图片索引,就可以显示对应索引位置的图片了。
ImageList imageList = new ImageList();
// 向列表中添加一些图片
imageList.Images.Add(Image.FromFile("D:\\123.jpg"));
ListView lv = new ListView();
lv.LargeImageList = imageList;
lv.Items.Add("hello", 0);
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯