So ListView has properties for icons - SmallImageList , StateImageList , LargeImageList which are used depending on the ListView display mode ( ListView property). When ImageList added to the image, you can specify an ImageKey , and for ListView.Items you can use this property to link the icon and the ListView element.
Accordingly, we solve the problem, for example, like this:
... //ΠΠ°Π·Π½Π°ΡΠ°Π΅ΠΌ ImageList Π΄Π»Ρ ListView, Π΅ΡΠ»ΠΈ Π΅ΡΠ΅ Π½Π΅ ΡΠ΄Π΅Π»Π°Π»ΠΈ ΡΡΠΎΠ³ΠΎ Π² ΡΡΡΠ΄ΠΈΠΈ: listView1.LargeImageList = imageList1; //ΠΠ°Π³ΡΡΠΆΠ°Π΅ΠΌ Π΄Π΅ΡΠΎΠ»ΡΠ½ΡΡ ΠΈΠΊΠΎΠ½ΠΊΡ Π² ImageList: System.Drawing.Image defaultIcon = Image.FromFile(@"D:\Default.ico"); imageList1.Images.Add("DefaultIcon", defaultIcon); //ΠΡΡΡ ΠΊ ΠΈΠΊΠΎΠ½ΠΊΠ΅: string fi = @"D:\SomeFolder\Icon.ico"; //ΠΠΌΡ ΠΈΠΊΠΎΠ½ΠΊΠΈ string iconKey = Path.GetFileNameWithoutExtension(fi); //ΠΠ°Π³ΡΡΠΆΠ°Π΅ΠΌ ΠΈΠΊΠΎΠ½ΠΊΡ Π² ImageList if (File.Exists(fi)) { System.Drawing.Image folderIcon = Image.FromFile(fi); imageList1.Images.Add(iconKey, folderIcon); } //ΠΡΠ»ΠΈ ΠΈΠΊΠΎΠ½ΠΊΠ° Π½Π΅ Π½Π°ΠΉΠ΄Π΅Π½Π°, ΠΈΡΠΏΠΎΠ»ΡΠ·ΡΠ΅ΠΌ ΠΈΠΊΠΎΠ½ΠΊΡ ΠΏΠΎ-ΡΠΌΠΎΠ»ΡΠ°Π½ΠΈΡ: else {iconKey = "DefaultIcon"} //ΠΠΎΠ΄ΠΊΠ»ΡΡΠ°Π΅ΠΌ ΠΈΠΊΠΎΠ½ΠΊΡ ΠΊ ΡΠ»Π΅ΠΌΠ΅Π½ΡΡ ListView: listView1.Items[0].ImageKey = iconKey; ...
If for some reason you need to remove the icon from the ImageList by its key, you can do it like this:
imageList1.Images.RemoveByKey(iconKey);