您的位置:首页 > 编程语言 > C#

C# picturebox 读取图片 的获得图片路径的几种方法

2017-03-01 11:08 1501 查看
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());
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: