0
我正在爲windows phone 7做一個應用程序。 應用程序正在從數據庫(Sql server 2008)中訪問一個圖像。 數據存儲在數據類型'image'中。我想顯示圖像。 我使用以下代碼byte []在windows phone 7應用程序中進行圖像轉換
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
byte[] data;
BitmapImage empImage = new BitmapImage();
Stream mm;
data = (byte[])value;
mm = new MemoryStream(data);
mm.Position = 0;
BinaryReader BR = new BinaryReader(mm);
byte[] image=BR.ReadBytes(data.Length);
mm = new MemoryStream(image);
//empImage.SetSource(mm);
return empImage;
}
但是有在註釋行一個「未指定」的錯誤(empImage.SetSource(毫米))。
請幫我......
棄用我不知道爲什麼這是否決。 – 2013-07-20 12:46:49
沒關係,它被拒絕了,因爲一個'BitmapSource'不能被實例化。 – 2013-07-20 12:48:26
@MathiasLykkegaardLorenzen - 好點,更新。 – 2013-07-20 12:53:39