C# ImageList 使用程式碼方式增加圖片
C# ImageList 使用程式碼方式增加圖片
資料來源:http://www.c-sharpcorner.com/uploadfile/9f4ff8/listview-in-c-sharp/
專案程式:https://github.com/jash-git/CS_ListView_Show_Type
宣告+設定
System.Windows.Forms.ImageList myImageList2 = new ImageList();
myImageList2.ImageSize = new Size(32, 32);
絕對路徑版:
myImageList1.Images.Add(Image.FromFile(@”C:\Users\Indus_User\Desktop\Icons\W\01.PNG”));
myImageList1.Images.Add(Image.FromFile(@”C:\Users\Indus_User\Desktop\Icons\W\02.PNG”));
myImageList1.Images.Add(Image.FromFile(@”C:\Users\Indus_User\Desktop\Icons\W\03.PNG”));
myImageList1.Images.Add(Image.FromFile(@”C:\Users\Indus_User\Desktop\Icons\W\04.PNG”));
myImageList1.Images.Add(Image.FromFile(@”C:\Users\Indus_User\Desktop\Icons\W\05.PNG”));
myImageList1.Images.Add(Image.FromFile(@”C:\Users\Indus_User\Desktop\Icons\W\06.PNG”));
myImageList1.Images.Add(Image.FromFile(@”C:\Users\Indus_User\Desktop\Icons\W\07.PNG”));
myImageList1.Images.Add(Image.FromFile(@”C:\Users\Indus_User\Desktop\Icons\W\08.PNG”));
myImageList1.Images.Add(Image.FromFile(@”C:\Users\Indus_User\Desktop\Icons\W\09.PNG”));
myImageList1.Images.Add(Image.FromFile(@”C:\Users\Indus_User\Desktop\Icons\W\10.PNG”));
相對路徑版:
myImageList1.Images.Add(Image.FromFile(@”01.PNG”));
myImageList1.Images.Add(Image.FromFile(@”02.PNG”));
myImageList1.Images.Add(Image.FromFile(@”03.PNG”));
myImageList1.Images.Add(Image.FromFile(@”04.PNG”));
myImageList1.Images.Add(Image.FromFile(@”05.PNG”));
myImageList1.Images.Add(Image.FromFile(@”06.PNG”));
myImageList1.Images.Add(Image.FromFile(@”07.PNG”));
myImageList1.Images.Add(Image.FromFile(@”08.PNG”));
myImageList1.Images.Add(Image.FromFile(@”09.PNG”));
myImageList1.Images.Add(Image.FromFile(@”10.PNG”));