2017-12-27 504 views
-2

如何解決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的類型。

+2

您試圖將URL字符串作爲圖像,而不是位於該URL的數據。 –

+0

picboxserver.ImageLocation = img2; –

回答

0

你想在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");