WP7中圖片設定成Content和Resource的區別

來源:互聯網
上載者:User

在WP7項目,圖片資源檔的屬性對話方塊Properties,在Build Action項有很多選項,但WP7中只支援:Content、Resource、none這三種。

設定為Content時會直接將圖片檔案打包到XAP檔案中,就是說用ZIP查看器可以直接看到你的圖片檔案;

設定為Resource後,圖片會編譯到XAP的Dll檔案內;

設定為none後,圖片既不會直接打包在xap檔案中,也不會嵌入xap中的dll內,編譯過程會完全忽略該檔案。

一般情況下,用Content更簡單,能獲得更好的效率。

MSDN的原文:

Set Build Action to Content for Media

Media processing on Windows Phone is optimized to use files and network streams, but not in-memory streams. This means that any media files included in the application, such as sound effects, should have their Build Action set to Content and not Resource. When a media file is compiled as content, it is stored as a loose file alongside the application file (.XAP) and is not stored inside it. When a media file is compiled as a resource, you typically access it by retrieving a stream to the file, which can decrease performance. Also, when a media file compiled as content is played back, it is played directly. When a media file is compiled as a resource, the content is copied to a file on Windows Phone before playback, which decreases performance. The following illustration shows how to set the Build Action of a file in Visual Studio.

有關Build Action的相關內容,參考這裡

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.