WPF中更改Image控件的source(使用相對路徑)


 絕對路徑:       

BitmapImage imagetemp = new BitmapImage(new Uri("E:\\Work\\Demo2.bmp", UriKind.Absolute));

image1.Source = imagetemp;

相對路徑:

BitmapImage imagetemp = new BitmapImage(new Uri("\\bin\\Debug\\Sources\\ON_btn_AutoDetect.bmp", UriKind.Relative));

image1.Source = imagetemp;


發佈了11 篇原創文章 · 獲贊 9 · 訪問量 18萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章