C# pictureBox.Image获得图片的三种方法


 1 1.绝对路径: 
 2 this.pictureBox.Image=Image.FromFile("C:\\test.jpg"); 
 3  
 4 2.相对路径: 
 5 Application.StartupPath;  
 6 可以得到程序根目录  
 7 this.pictureBox.Image=Image.FromFile(Application.StartupPath "\\test.jpg"); 
 8  
 9 3.获得网络图片的路径 
10 string url="http://img.zcool.cn/community/01635d571ed29832f875a3994c7836.png@900w_1l_2o_100sh.jpg";
11 this.pictureBox.Image= Image.FromStream(System.Net.WebRequest.Create(url).GetResponse().GetResponseStream());

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM