Winform绑定图片的三种方式

引用博客网站:https://www.cnblogs.com/H2921306656/p/6761539.html

 

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());

posted @ 2018-03-13 11:17  Mark.Yang  阅读(549)  评论(0)    收藏  举报