WP7备注(8)(WebClient读取图片)
2011-04-26 17:03
190 查看
远程图片数据申请:
XNA:
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); WebClient webClient = new WebClient(); webClient.OpenReadCompleted += OnWebClientOpenReadCompleted; webClient.OpenReadAsync(new Uri("http://www.charlespetzold.com/Media/HelloWP7.jpg")); } void OnWebClientOpenReadCompleted(object sender, OpenReadCompletedEventArgs args) { if (!args.Cancelled && args.Error == null) { helloTexture = Texture2D.FromStream(this.GraphicsDevice, args.Result); } }
Silverlight:
protected override void OnManipulationStarted(ManipulationStartedEventArgs args) { WebClient webClient = new WebClient(); webClient.OpenReadCompleted += OnWebClientOpenReadCompleted; webClient.OpenReadAsync(new Uri("http://www.charlespetzold.com/Media/HelloWP7.jpg")); args.Complete(); args.Handled = true; base.OnManipulationStarted(args); } void OnWebClientOpenReadCompleted(object sender, OpenReadCompletedEventArgs args) { if (!args.Cancelled && args.Error == null) { BitmapImage bmp = new BitmapImage(); bmp.SetSource(args.Result); img.Source = bmp; } }
图片编译进入DLL字符串格式:
"/SilverlightDemo;component/Images/HelloWorld.png"
相关文章推荐
- WP7独立存储之IsolatedStorageFile之图片的存储和读取
- WP7 Isolated Storage详解(7)-读取、保存图片文件
- WP7 Isolated Storage详解 读取、保存图片文件
- WP7 IsolatedStorage--读取、保存图片文件
- WP7 IsolatedStorage--读取、保存图片文件
- WP7 Isolated Storage详解(7)-读取、保存图片文件
- wp7用独立存储空间保存服务器图片和从独立存储空间读取图片
- OpenCV imread读取图片失败
- 有关AS3跨域读取图片文件报错“checkPolicyFile”的解决方法
- Java读取图片分辨率
- ASP.NET读取网络图片并在页面上显示
- 用nginx-gridFS读取MongoDB的图片
- 数据库存储图片读取
- 如何读取图片
- Unity中读取安卓相册选择图片的方法
- Android 读取R.raw文件夹下图片的分辨率问题
- asp.net 如何读取文件夹下所有图片名称
- 【转】 OpenGL使用libPng读取png图片
- 如何读取jar包中的图片?
- VC操作Word读取图片