我试着用FileStream
读取图像文件,并将它成功地阅读它,但它输出此错误消息如何正确读取图像文件?
“参数无效”。
public Bitmap streamimage(string Fname)
{
Bitmap bm;
using (FileStream stream = new FileStream(Fname, FileMode.Open, FileAccess.Read))
{
bm = (Bitmap)Image.FromStream(stream);
stream.Close();
return bm;
}
}
您是否了解[此位图构造函数](https://msdn.microsoft.com/zh-cn/library/0cbhe98f.aspx)?你可以尝试删除'stream.Close()',它将被自动关闭,因为它被封装在'using'中。 – Blorgbeard
指出...我可以知道什么原因“参数无效” –