说明:
关键代码就以下几句。
代码:
[C#] 纯文本查看 复制代码 #region 下载图片到Image
public static Image UrlToImage(string url) {
WebClient mywebclient = new WebClient();
byte[] Bytes = mywebclient.DownloadData(url);
using (MemoryStream ms = new MemoryStream(Bytes)) {
Image outputImg = Image.FromStream(ms);
return outputImg;
}
}
#endregion
|