private Image GetImage(string url)
{
if (string.IsNullOrEmpty(url))
return null;
WebClient webClient = new WebClient();
MemoryStream stream = null;

try
{
byte[] byteImage = webClient.DownloadData(url);
stream = new MemoryStream(byteImage);
Image image = (Image)new Bitmap(stream);
return image;
}
catch
{
return null;
}
finally
{
stream.Close();
webClient.Dispose();
}
}

posted on 2012-02-29 18:04  小白白小  阅读(156)  评论(0)    收藏  举报