WP7中图片设置成Content和Resource的区别
2011-11-14 11:27
309 查看
在WP7项目,图片资源文件的属性对话框Properties,在Build Action项有很多选项,但WP7中只支持:Content、Resource、none这三种。
设置为Content时会直接将图片文件打包到XAP文件中,就是说用ZIP查看器可以直接看到你的图片文件;
设置为Resource后,图片会编译到XAP的Dll文件内;
设置为none后,图片既不会直接打包在xap文件中,也不会嵌入xap中的dll内,编译过程会完全忽略该文件。
一般情况下,用Content更简单,能获得更好的效率。
MSDN的原文:
有关Build Action的相关内容,参考这里
设置为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的相关内容,参考这里
相关文章推荐
- 在wp7中读取XML的配置文件,Content与Resource的区别
- java中button背景图片大小设置,JFrame.getContentPane().add(pane)与JFrame.add(pane)区别
- 在wp7中读取XML的配置文件,Content与Resource的区别
- 设置了背景图片的TextView,其尺寸设置为wrap_content时,并不是适应文字内容大小
- Android图片setBackgroundResource和setImageResource的区别
- WP开发加载图片及文字Resource/Content说明
- setContentScaleFactor 设置图片的分辨率
- UITableViewCell 的Image设置了UIViewContentModeScaleAspectFill后图片超出去了
- Android进阶UI之ImageView设置长度高度为wrap_content时高度根据图片比例自适应
- 打xap包的时候content和resource的区别
- Content-Disposition 指定该被下载时的名称:attachment和inline的区别,使用a标签下载时,文件的ContentDisposition属性设置
- WP7 working with Images: Content vs Resource build action
- Java代码给控件设置背景颜色或图片setBackgroundResource
- Android ImageView设置长度高度为wrap_content时高度根据图片比例自适应
- WP7开发解惑:BuildAction之Content与Resource
- 对于bitmap和一些设置图片setImageResource()和setImagebitmap()方法减少内存使用的方法
- CSS基础知识二(段落设置CSS效果、图片边框、div和span区别、CSS控制背景、CSS控制链接)
- WP开发加载图片及文字Resource/Content说明
- Content-disposition中Attachment和inline的区别、ContentType设置
- UIImageView设置UIViewContentModeScaleAspectFill 图片平铺展开