Winform 显示远程图片
后面的小项目要用到,为了防止忘记,特记录下来:
Image ReadURLImageToStream(string URLimage)
{
Uri uri=new Uri(URLimage);
WebRequest req=WebRequest.Create(uri);
WebResponse resp=req.GetResponse();
Stream str=resp.GetResponseStream();
Image img=Image.FromStream(str);
return img;
}
调用:
this.pictureBox1.Image=ReadURLImageToStream(imgPath);