//加载系统图片
private void LoadImage()
{
#region
ImageList imglist = new ImageList();
List<string> keylist = new List<string>();
imglist.ImageSize = new Size(48, 48);
imglist.ColorDepth = ColorDepth.Depth32Bit; //添加系统图片
imglist.Images.Add("Fish", PreinstallImages.Fish);
keylist.Add("Fish");
imglist.Images.Add("ColdDish",PreinstallImages.ColdDish);
keylist.Add("ColdDish");
imglist.Images.Add("DefaultImage",PreinstallImages.DefaultImage);
keylist.Add("DefaultImage");
imglist.Images.Add("Drink",PreinstallImages.Drink);
keylist.Add("Drink");
imglist.Images.Add("Rice", PreinstallImages.Rice);
keylist.Add("Rice");
//imglist.Images.Add(PreinstallImages.ErrorImage);
this._lvSystemImages.LargeImageList = imglist;
for (int i = 0; i < imglist.Images.Count; i++)
{
ListViewItem lvi = new ListViewItem();
lvi.ImageIndex = i;
lvi.Text = keylist[i];
lvi.ToolTipText = keylist[i];
this._lvSystemImages.Items.Add(lvi);
}
#endregion
}
imgList 要设置为View属性改成LargeIcon。
ListView 的LargeImageList = “你的ImageList”
vs2010正式版安装图解 visual studio 2010安装过程