private Image ReadImageFromUrl(string urlImagePath)
{
           Uri uri = new Uri(urlImagePath);
           WebRequest webRequest = WebRequest.Create(uri);
           Stream stream = webRequest.GetResponse().GetResponseStream();
           Image res = Image.FromStream(stream);
           return res;
 
}
System::Drawing::Image^ ReadImageFromUrl(System::String ^urlImagePath)
	{
	System::Uri ^uri = gcnew Uri(urlImagePath);
	System::Net::WebRequest ^webRequest;
	webRequest = System::Net::WebRequest::Create(uri);
	System::IO::Stream ^stream = webRequest->GetResponse()->GetResponseStream();
	Image ^res = Image::FromStream(stream);
	return res;
	}

接收方法回傳的Image後就可以再利用Bitmap改變圖片大小設定給pictureBox1囉!

		Bitmap ^photo = gcnew Bitmap(ReadImageFromUrl(sctemp),399,537);
		pictureBox1->Image=photo;

參考資料:當麻許

文章標籤
創作者介紹

宇若彎彎

周宇若 發表在 痞客邦 PIXNET 留言(0) 人氣()