簡體   English   中英

嘗試在c#中創建Writablebitmap實例時WP8應用程序崩潰-內存不足

[英]WP8 App crashes while trying to create instance of Writablebitmap in c# -Insufficient memory

我想在Windows Phone應用中將圖像轉換為字節數組和字節轉換為圖像。 現在,我試圖將圖像轉換為字節轉換

首先,我創建一個參數為uielement的writablebitmap類實例(即)

WriteableBitmap btmMap = new WriteableBitmap(Imagecontrol,null); 

在此行中,由於

內存不足,無法繼續執行程序

我如何在wp8中解決此問題?

您不需要使用帶有UIElement參數的WriteableBitmap構造函數,因為Image控件中已經具有WriteableBitmap

只需將Image控件的Source屬性轉換為WriteableBitmap即可:

WriteableBitmap wb = Imagecontrol.Source as WriteableBitmap;

也許這樣可以避免內存不足異常。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM