pictureBox控件獲得圖片路徑的三種方法及自適應大小屬性


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

 

自適應大小屬性:BackGroundImageLayout=Stretch,SizeMode=StretchImage


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM