简体   繁体   中英

System.Drawing Image.FromFile

 ImageList listImages = new ImageList();
 String[] imageFiles = Directory.GetFiles(@"C:\icones");
 foreach (var file in imageFiles) {
            //ajouter images a la listeImages
            listImages.Images.Add(Image.FromFile(file));
}

I want to add image icons to my listview but I can't find a methode System.Drawing.Image.( FromFile ) I found just this Image.( FromHbitamp ) ??? someone can help me ? i use cf 3.5

According to an answer on this forum , for an icon you can first make a FileStream from your file path and then create an Icon from that using the appropriate Icon constructor. For an ordinary Bitmap image, there's a Bitmap constructor that takes a path.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM