[求助]用FromStream来创建Image与用FromFile来创建Image有何区别?
问: 为什么要用FileStream来创建Image,而不真接用Image.FromFile(string fileName)来创建,两者区别在哪? public static Image GetImageFromServer(string fileName)
{
Image img = null;
string filePath = Application.StartupPath + "\\Image\\" + fileName;
try
{
FileStream fs = File.OpenRead(filePath);
img = Image.FromStream(fs);
fs.Close();
}
catch (IOException ie)
{
MessageBox.Show(ie.Message);
}
return img;
}