标签:ima name from code close 图标 src static ati
public static void SetListView(ListView lstVw, string[] fileNames) { //清空 lstVw.Items.Clear(); lstVw.LargeImageList = null; //设置属性 var imgLstTemp = new ImageList(); imgLstTemp.ImageSize = new Size(240, 180); lstVw.MultiSelect = true; //循环添加 for (int i = 0; i < fileNames.Length; i++) { string text = fileNames[i]; Image image = Image.FromFile(text); lstVw.LargeImageList.Images.Add(text, image); FileInfo fileInfo = new FileInfo(text); lstVw.Items.Add(text, fileInfo.Name, i); } //设置图标 lstVw.LargeImageList = imgLstTemp; }
private void Set_ListView(ListView lv,string[] filePaths) { //清空 lv.Items.Clear(); lv.LargeImageList = null; //设置属性 var imgLstTemp = new ImageList(); imgLstTemp.ColorDepth = ColorDepth.Depth32Bit; imgLstTemp.ImageSize = new Size(64, 64); //循环添加路径、图标、索引 for (int i = 0; i < filePaths.Length; i++) { var curPath = filePaths[i]; var img = BaoX.ICO.GetIcon(curPath); imgLstTemp.Images.Add(curPath,img); var info = new FileInfo(curPath); lv.Items.Add(curPath, info.Name, i); } //设置图标 lv.LargeImageList = imgLstTemp; }
标签:ima name from code close 图标 src static ati
原文地址:http://www.cnblogs.com/fabao/p/7646697.html