简体   繁体   English

System.Drawing Image.FromFile

[英]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 ) ??? 我想将图像图标添加到列表视图中,但找不到方法System.Drawing.Image。( FromFile )我只找到了此Image。( FromHbitamp )? someone can help me ? 有人可以帮助我吗? i use cf 3.5 我使用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. 根据该论坛上的答案,对于图标,您可以首先从文件路径创建FileStream ,然后使用适当的Icon构造函数从该文件路径创建一个Icon For an ordinary Bitmap image, there's a Bitmap constructor that takes a path. 对于普通的Bitmap图像,有一个带路径的Bitmap构造函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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