listview控件中显示图片 用ImageList,ListView1.Items[i].ImageIndex=0;指定ListView每一项的ImageIndex 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://tech.techweb.com.cn/thread-253657-1-1.html个人的感觉是不在wpf中的话,用datagridview更方便。 可以选择listview的view属性设置是大图标还是小图标创建一个imageList加入你想要显示的图片然后listview的每一项的索引与imageList的索引关联就可以了 this.listView1.Items[i].ImageIndex =1 ListViewItem item = new ListViewItem("1"); Image image = ConvertToImage(""); imageList1.Images.Add(image); item.ImageIndex = 1; listView1.Items.Add(item); item.SubItems.Add(""); item.SubItems.Add(""); public static byte[] ConvertToBytes(string fileName) { Image image = Image.FromFile(fileName); BinaryFormatter bf = new BinaryFormatter(); MemoryStream ms = new MemoryStream(); bf.Serialize(ms, image); byte[] result = new byte[ms.Length]; ms.Position = 0; ms.Read(result, 0, result.Length); ms.Close(); return result; } webbrowser 提交的问题? 新手提问,请问如何设置messagebox的初始显示位置 请问VC++6.0中如何让代码排列整齐啊? 根据订单表更新库存表(vfp) 如何访问BindingSource里的数据 请大家一起来探讨! c#问题求助 简单的字符转换问题!请帮忙! 能否将字符串转换为变量名? 有没有人指导下怎么写ON/off模型 关类中 变量和属性 的问题 多媒体中控机编程
创建一个imageList加入你想要显示的图片
然后listview的每一项的索引与imageList的索引关联就可以了
Image image = ConvertToImage("");
imageList1.Images.Add(image);
item.ImageIndex = 1;
listView1.Items.Add(item);
item.SubItems.Add("");
item.SubItems.Add("");
public static byte[] ConvertToBytes(string fileName) {
Image image = Image.FromFile(fileName);
BinaryFormatter bf = new BinaryFormatter();
MemoryStream ms = new MemoryStream();
bf.Serialize(ms, image);
byte[] result = new byte[ms.Length];
ms.Position = 0;
ms.Read(result, 0, result.Length);
ms.Close();
return result;
}