silverlight
发布时间:2022-05-04 发布网站:大佬教程 code.js-code.com
大佬教程收集整理的这篇文章主要介绍了使用Silverlight2的WebClient下载远程图片,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
概述
在Silverlight 2之前有一个Downloader对象,开发者一般使用Downloader下载图片和文体文件,
这个对象在Silverlight 2中作为了一个特性被集成到WebClient类之中,你可以直接使用WebClient的OpenReadAsync方法加载远程图片的URI,然后使用Open
ReadCoR_908_11845@pleted回调事件来返回Result,最后使用BitmapImage的SetS
在Silverlight 2之前有
一个Downloader对象,开发者一般使用Downloader下载
图片和文体
文件,
这个对象在Silverlight 2中作为了
一个特性被集成到WebClient类之中,你可以直接使用WebClient的OpenReadAsync
方法加载远程
图片的URI,然后使用Open
ReadCoR_908_11845@pleted回调事件来返回Result,最后使用BitmapImage的Set
source
方法声明位图
文件的源即可!
WebClient webClientDownloader = new WebClient(
);
webClientDownloader
.open
ReadCoR_908_11845@pleted +=
new open
ReadCoR_908_11845@pletedEventHandler(webClientDownloader_Open
ReadCoR_908_11845@pleted
);
webClientDownloader
.openReadAsync(new Uri(
String.Format("
{0}/../Images/
{1}",Application.Current.Host
.source,image
sourcE))
);
webClientDownloader
.openReadAsync(new Uri(
String.Format("Images/
{0}",image
sourcE))
);
void webClientDownloader_Open
ReadCoR_908_11845@pleted(ob
ject sender,Open
ReadCoR_908_11845@pletedEventArgs
E)
BitmapImage bi = new BitmapImage(
);
}
另外Beta2 中的
图片动态设置的
方法与Beta1不同
Image image = new Image(
); Uri uri = new Uri(image
source,UriKind.Relativ
E);
Image
source img = new Sy
stem.Window
s.Media.Imaging
.bitmapImage(uri
); imageBrush.
SETVALue(ImageBrush.Image
sourceProperty,img
);
大佬总结
以上是大佬教程为你收集整理的使用Silverlight2的WebClient下载远程图片全部内容,希望文章能够帮你解决使用Silverlight2的WebClient下载远程图片所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。