代碼如下:c# pictureBox1.Image的獲得圖片路徑的三種方法 winform
1.絕對路徑:
this.pictureBox2.Image=Image.FromFile("D:\\001.jpg");
2.相對路徑:
Application.StartupPath;
可以得到程序根目錄
string picPath=Application.StartupPath+"\\1.gif";
3.獲得網絡圖片的路徑
this.pictureBox2.Image= Image.FromStream(System.Net.WebRequest.Create(http://www.xyhhxx.com/images/logo/logo.gif).GetResponse().GetResponseStream());
注:轉自http://www.cnblogs.com/hfzsjz/archive/2010/01/06/1640176.html