【发布时间】:2010-04-14 11:54:53
【问题描述】:
我正在制作一个使用许多图像的应用程序。该应用程序从服务器获取图像,并一次下载一个。 在许多图像之后,位图的创建返回一个异常,但我不知道如何解决这个问题。这是我下载图片的功能:
public static Bitmap getImageFromWholeURL(String sURL)
{
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(sURL);
myRequest.Method = "GET";
// If it does not exist anything on the url, then return null
try
{
HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(myResponse.GetResponseStream());
myResponse.Close();
return bmp;
}
catch (Exception e)
{
return null;
}
}
有人可以帮我吗? 提前致谢!
【问题讨论】:
-
你对返回的 bmp 对象做了什么?在此处发布该代码。
标签: c# memory compact-framework bmp