2014-03-12 24 views

回答

0

第一步:聲明這樣

的BitmapImage位全局變量;

步驟2: 通過使用switch語句選擇圖像的URI:

public void ChoseUri(string cuntryName) 
     { 
      switch (cuntryName) 
      { 
       case "US": 
        bit = new BitmapImage(new Uri(@"Image/Us.png", UriKind.RelativeOrAbsolute)); 
        break; 
       case "INDIA":         
        bit = new BitmapImage(new Uri(@"Image/INDIA.png", UriKind.RelativeOrAbsolute)); 
        break; 
       default: 
      } 
     } 

第三步:設置動態圖像源:

imgCountry.Source =位;

+0

設置你的五國烏里裏面這個switch語句 –

+0

謝謝Pradeep。 – Kanniyappan

+0

okz ........朋友 –

相關問題