日期:2014-05-18 浏览次数:20900 次
using System.IO; using System.Net; HttpWebRequest vHttpWebRequest = (HttpWebRequest)WebRequest.Create( @ http://img.***.com/cgi-bin/personal/agetimg.cgi?request=23000000fc058ef58c5242ceed730c076785f49de0b6e926fd91b4a20aee859babc8a2507e8753c509805266"); HttpWebResponse vHttpWebResponse = (HttpWebResponse)vHttpWebRequest.GetResponse(); BinaryReader vBinaryReader = new BinaryReader(vHttpWebResponse.GetResponseStream()); MemoryStream vMemoryStream = new MemoryStream(); byte[] vBuffer = new byte[0x1000]; int vReadLength = vBinaryReader.Read(vBuffer, 0, vBuffer.Length); while (vReadLength > 0) { vMemoryStream.Write(vBuffer, 0, vReadLength); vReadLength = vBinaryReader.Read(vBuffer, 0, vBuffer.Length); } vHttpWebResponse.Close(); vMemoryStream.Position = 0; pictureBox1.Image = Bitmap.FromStream(vMemoryStream); vMemoryStream.Close();