zoukankan      html  css  js  c++  java
  • CaseStudy(showcase)数据篇加载图片

    做silvelight也有一段时间了,相册、游戏,刚刚完成的showcase这个小程序算是一个阶段了。这里就以showcase这个项目来做一下CaseStudy。

    数据篇-加载图片

    beta1到beta2中加载图片的方法有些改变。

            private void LoadImage(String MediaUrl)
            {
                Uri uri 
    = new Uri(HtmlPage.Document.DocumentUri, MediaUrl);
                
                WebClient imgClient 
    = new WebClient();
                imgClient.OpenReadCompleted 
    += new OpenReadCompletedEventHandler(imgClient_OpenReadCompleted);
                imgClient.OpenReadAsync(uri);
            }

            
    void imgClient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
            {
                
    if (e.Error == null)
                {
                    BitmapImage bi 
    = new BitmapImage();
                    bi.SetSource(e.Result);
                    xImage.Source 
    = bi;
                }
            }

     另一种方法

                Uri uri = new Uri(HtmlPage.Document.DocumentUri, MediaUrl);
                ImageSource img 
    = new System.Windows.Media.Imaging.BitmapImage(uri);
                xImage.SetValue(Image.SourceProperty, img);


    作者:nasa
    出处:nasa.cnblogs.com
    联系:nasa_wz@hotmail.com
    QQ:12446006

  • 相关阅读:
    python 用到的函数记录
    scala函数定义的四种方式
    java mail使用中遇到的550类型错误
    @Secured(), @PreAuthorize()
    jQuery each
    基于jQuery动态创建html元素
    jQuery validate在没有校验通过的情况下拒绝提交
    区别: @Secured(), @PreAuthorize() 及 @RolesAllowed()
    http meta
    注解:@Autowired
  • 原文地址:https://www.cnblogs.com/nasa/p/1248972.html
Copyright © 2011-2022 走看看