pictureBox1.Image的获得图片路径的三种方法
生活随笔
收集整理的這篇文章主要介紹了
pictureBox1.Image的获得图片路径的三种方法
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1. 絕對路徑:? this.pictureBox2.Image=Image.FromFile("D://1.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.mxmx.com/logo.gif).GetResponse().GetResponseStream());
2. 相對路徑:? Application.StartupPath; ? 可以得到程序根目錄 ? this.pictureBox2.Image=Image.FromFile(Application.StartupPath "//1.gif");?
3. 獲得網絡圖片的路徑? this.pictureBox2.Image= Image.FromStream (System.Net.WebRequest.Create (http://www.mxmx.com/logo.gif).GetResponse().GetResponseStream());
總結
以上是生活随笔為你收集整理的pictureBox1.Image的获得图片路径的三种方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: C#文件加密和解密
- 下一篇: Windows 创建符号链接