如何取出一个目录下的image文件,存入一个数组中?

来源:百度知道 编辑:UC知道 时间:2024/05/16 09:54:07
RT``
用c#```

请大虾讲一下
补充一下`
我是想实现如下功能---

用openfiledialog选择出一个图片文件的路径
然后将该图片所在文件夹下的所有图片文件(路径)装入一个数组里面,以便于实现浏览文件夹下图片的功能

参考我的代码
DialogResult result = openFileDialog1.ShowDialog();
if (result.ToString() == "OK")
{
foreach (string fileName in openFileDialog1.FileNames)
lisPictures.Items.Add(fileName);
}

using System.IO;
DirectoryInfo DInfo=new DirectoryInfo(@".\*.jpg");
FileSystemInfo[] FSInfo=DInfo.GetFileSystemInfos();//你要的数组
for(int i=0;i<FSInfo.Length;i++)
{
FileInfo FInfo=new FileInfo(%%1+FSInfo[i].ToString());
//FInfo;枚举数组中的元素
}

Image[] imList = new Image[10];
imList[0] = new Bitmap(new System.IO.FileStream("路径",System.IO.FileMode.OpenOrCreate));

很精炼的代码,我以前写的比较复杂

Byte数组?