将图像从 url 加载到 Drawing.Image 的最佳方法?
我找到了这两种方法,哪一种更好还是有更好的方法?
PictureBox pb = new PictureBox();
pb.ImageLocation = "http://lovelypackage.com/wp-content/uploads/2012/02/lovely-package-whatever-wine4.jpg";
Image img = pb.Image;
或者
using (WebClient wc = new WebClient())
{
byte[] bytes = wc.DownloadData("http://lovelypackage.com/wp-content/uploads/2012/02/lovely-package-whatever-wine4.jpg");
MemoryStream ms = new MemoryStream(bytes);
Image img = Image.FromStream(ms);
}