将图标加载到我的列表视图时出现问题。我可以让图像在大视图中工作,但不能在细节上工作,不太确定我做错了什么。
private void CreateList()
{
listView1.View = View.Details;
listView1.Columns.Add("Icon", -2, HorizontalAlignment.Center);
listView1.Columns.Add("Name", -2, HorizontalAlignment.Left);
imageList1.ImageSize = new Size(32, 32);
for (int i = 0; i < subKeys.Length; i++)
{
if (subKeys[i].Contains("App"))
{
imagePath = subKeys[i];
if (System.IO.File.Exists(imagePath))
{
imageList1.Images.Add(Image.FromFile(imagePath));
}
numberOfImages++;
}
}
listView1.StateImageList = this.imageList1;
}