silverlight   发布时间:2022-05-04  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了使用Silverlight2的WebClient下载远程图片大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

在Silverlight 2之前有一个Downloader对象,开发者一般使用Downloader下载图片和文体文件,这个对象在Silverlight 2中作为了一个特性被集成到WebClient类之中,你可以直接使用WebClient的OpenReadAsync方法加载远程图片的URI,然后使用OpenReadCoR_908_11845@pleted回调事件来返回Result,最后使用BitmapImage的SetS
在Silverlight 2之前有一个Downloader对象,开发者一般使用Downloader下载图片和文体文件这个对象在Silverlight 2中作为了一个特性被集成到WebClient类之中,你可以直接使用WebClient的OpenReadAsync方法加载远程图片的URI,然后使用OpenReadCoR_908_11845@pleted回调事件来返回Result,最后使用BitmapImage的Setsource方法声明位图文件的源即可!
 
 
代码如下:
WebClient webClientDownloader = new WebClient();
webClientDownloader.openReadCoR_908_11845@pleted += new openReadCoR_908_11845@pletedEventHandler(webClientDownloader_OpenReadCoR_908_11845@pleted);
webClientDownloader.openReadAsync(new Uri(String.Format("{0}/../Images/{1}",Application.Current.Host.source,imagesourcE)));
webClientDownloader.openReadAsync(new Uri(String.Format("Images/{0}",imagesourcE)));
void webClientDownloader_OpenReadCoR_908_11845@pleted(object sender,OpenReadCoR_908_11845@pletedEventArgs E)
{
BitmapImage bi = new BitmapImage();
bi.Setsource(e.Result);
image.source = bi;
}
另外Beta2 中的图片动态设置的方法与Beta1不同
 
            Image image = new Image();             Uri uri = new Uri(imagesource,UriKind.RelativE);             Imagesource img = new System.Windows.Media.Imaging.bitmapImage(uri);             imageBrush.SETVALue(ImageBrush.ImagesourceProperty,img);

大佬总结

以上是大佬教程为你收集整理的使用Silverlight2的WebClient下载远程图片全部内容,希望文章能够帮你解决使用Silverlight2的WebClient下载远程图片所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。