110,499
社区成员
发帖
与我相关
我的任务
分享
string[] files = System.IO.Directory.GetFiles("c:\\AppData\\AppName\\images\\*.jpg");
foreach (string path in files)
{
string key = System.IO.Path.GetFileName(path);
System.Drawing.Image image;
try
{
image = Image.FromFile(path);
imageList1.Images.Add(key, image);
}
catch(Exception ex)
{
Console.WriteLine("图片[0}加载失败,原因:{1}", path, ex.Message);
}
}