看来您将其存储Image locations
在同一个 DataTable 中。如果您ImageList
在处理 foreach 循环的同时存储这些图像位置,那将是可以理解的。这是示例代码:
lvPtMedicalRecord.LargeImageList = myImageList; //Attaching ImageList to the ListView
int imageIndex = 0;
foreach (DataRow rows in dtPath.Rows)
{
//Store the paths of the images in the same DataTable (I can think of this only)
myImageList.Images.Add(Image.FromFile(row[0].ToString());
ListViewItem lvi = new ListViewItem();
lvi.ImageIndex = imageIndex; //Index of the Image present in the `ImageList`
imageIndex++;
lvPtMedicalRecord.Items.Add(lvi);
}
更新:
为了使图像变大:
myImageList.ImageSize = new System.Drawing.Size(112, 112); // width, height