如何解决System.Drawing中 - 参数无效
问题描述:
如何解决System.Drawing中参数无效 当我使用代码:如何解决System.Drawing中 - 参数无效
string img2 = "http://13.228.146.249:8080/jcr/groups/629.png;
byte[] toBytes = Encoding.ASCII.GetBytes(img2);
if (toBytes != null)
{
MemoryStream ms = new MemoryStream(toBytes);
ms.Position = 0;
picboxserver.Image = Image.FromStream(ms);
}
picboxserver是PictureBox的类型。
答
你想在http://13.228.146.249:8080/jcr/groups/629.png
里面你的PictureBox?在这种情况下,只需使用Load()
-Function:
picboxserver.Load("http://13.228.146.249:8080/jcr/groups/629.png");
您试图将URL字符串作为图像,而不是位于该URL的数据。 –
picboxserver.ImageLocation = img2; –