好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

在C#开发时pictureBox控件获得图片路径的三种方法

1.绝对路径: 

          this.pictureBox.Image=Image.FromFile("C:\\test.jpg");  

2.相对路径: 

         Application.StartupPath;  

        可以得到程序根目录  

        this.pictureBox.Image=Image.FromFile(Application.StartupPath + "\\test.jpg"); 

 3.获得网络图片的路径 

          string url="http://baidu.com/aaa.jpg";

         this.pictureBox.Image= Image.FromStream(System.Net.WebRequest.Create(url).GetResponse().GetResponseStream());

 


查看更多关于在C#开发时pictureBox控件获得图片路径的三种方法的详细内容...

  阅读:68次