假设:listview1 下有两个 listviewitem:listviewitem1、listviewitem2
listview1 的SmallImageList、LargeImageList 均为 imageList1
显示的时候,listviewitem1、listviewitem2 显示了不同的图标。问题:我现在想在listviewitem的图标的右下角加一个picturebox。用以显示“锁定、快捷方式”等图片。
实现类似exploer.exe 中快捷方式的样式。【不想采取在 imageList 加上对应快捷方式的图标。】
这样就需要获取listviewitem 图标对象,从而获取其位置。
问题就来了,这个图标对象是什么?怎么写?
listviewitem 图标对象
listview1 的SmallImageList、LargeImageList 均为 imageList1
显示的时候,listviewitem1、listviewitem2 显示了不同的图标。问题:我现在想在listviewitem的图标的右下角加一个picturebox。用以显示“锁定、快捷方式”等图片。
实现类似exploer.exe 中快捷方式的样式。【不想采取在 imageList 加上对应快捷方式的图标。】
这样就需要获取listviewitem 图标对象,从而获取其位置。
问题就来了,这个图标对象是什么?怎么写?
listviewitem 图标对象
private string GetBackImgPath(string imgstr)
{
string CPath = "";
if (CurrentPath.Contains("bin"))
{
int tmpBin = CurrentPath.IndexOf("\\bin"); CPath = CurrentPath.Substring(0, tmpBin);
}
string tmpPath = Path.Combine(CPath, "Resources");
string strPath = Path.Combine(tmpPath, imgstr);
return strPath;
}
listview.BackgroundImage = Image.FromFile(GetBackImgPath("图片名.png"))