我不知道自己做错了什么,但我的代码非常相似to this one,我无法让它发挥作用。无论如何,图像都不显示。
var listView = new ListView();
var imageList = new ImageList();
imageList.Images.Clear();
listView.Items.Clear();
var imagenes = Directory.GetFiles(csGlobal.rutaImagenes, "*.jpg", SearchOption.TopDirectoryOnly).OrderBy(f => f);
imageList.ImageSize = new Size(32, 32);
foreach (var image in imagenes)
{
Bitmap img = new Bitmap(image);
imageList.Images.Add(img);
}
listView.View = View.LargeIcon;
listView.LargeImageList = imageList;
for (int j = 0; j < imageList.Images.Count; j++)
{
ListViewItem item = new ListViewItem();
item.ImageIndex = j;
listView.Items.Add(item);
}
编辑固定设置OwnerDraw为false(01/03/2017)