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

  • 相关阅读:
    什么是分布式系统?
    Asp组件中级入门与精通系列之五
    什麼是RIA?
    .NET Remoting编程简介
    WEB打印大全(转)
    ASP与ActiveX控件交互实战(二)
    Asp组件中级入门与精通系列之七
    jswindow对象的方法和属性资料
    什麼是SOAP?
    体验Visual Studio 2005之类设计器
  • 原文地址:https://www.cnblogs.com/nasa/p/1248972.html
Copyright © 2011-2022 走看看