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

时间:2020-03-13 10:51:15   收藏:0   阅读:459
 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());

 

原文:https://www.cnblogs.com/ybqjymy/p/12484417.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!