pictureBox1.Image获得图片路径的三种方法

【声明】转载自:http://blog.csdn.net/cyy089074316/article/details/7270741

1.绝对路径: 
this.pictureBox2.Image=Image.FromFile("D:\\001.jpg"); 

2.相对路径: 
Application.StartupPath;  
可以得到程序根目录  
this.pictureBox2.Image=Image.FromFile(Application.StartupPath "\\1.gif"); 

3.获得网络图片的路径 
法一:this.pictureBox2.Image= Image.FromStream(System.Net.WebRequest.Create(http://www.pxkt.com/logo.gif).GetResponse().GetResponseStream());

法二:is.pictureBox1.ImageLocation = "http://b.hiphotos.baidu.com/news/pic/item/c995d143ad4bd113db3dc15658afa40f4afb05e5.jpg";

 

 

 

posted @ 2014-01-04 16:37  大漠孤烟~  阅读(1981)  评论(0编辑  收藏  举报