C# 通过URL获取图片并显示在PictureBox上的方法

Random seed = new Random(); WebRequest webreq = WebRequest.Create("http://ptlogin2.qq.com/getimage?aid=15000102&" + seed.NextDouble()); WebResponse webres = webreq.GetResponse(); Stream stream = webres.GetResponseStream(); Image image; image = Image.FromStream(stream); stream.Close(); pictureBox1.Image = image;

你可能感兴趣的:(C#)