我有這樣一個類:如何從byte []創建FileStreame?
class person
{
public string Name{get;set;}
public byte[] PersonImage{get;set;}
}
當我加載我一個人從數據庫中我想顯示在圖像控制PersonImage,所以我想從我的byte []創建的BitmapImage:
var bitmapImage = new BitmapImage();
bitmapImage.BeginInit();
var filestream = new MemoryStream(PersonImage);
bitmapImage.StreamSource = filestream;
bitmapImage.EndInit();// I have Exception in this line
我的例外是:
否成像合適的用於完成此操作部件被發現。
--edite 我內心的例外是:
內部異常:從HRESULT異常:0 * 88982F50
你有沒有看着 - http://stackoverflow.com/questions/3886849/錯誤在我的字節到wpf-bitmapimage轉換 - 它可能有幫助(如何提問者做他們的字節圖像流轉換) – kaj 2012-03-15 17:24:15
可能重複的[創建新的FileStream出一個字節數組](http:// stackoverflow.com/questions/6076192/create-new-filestream-out-of-a-byte-array) – RedFilter 2012-03-15 17:24:24
你最好看看寫入數據到dbase的代碼。這個問題不是其他方面的問題。 – 2012-03-15 17:28:24