zoukankan      html  css  js  c++  java
  • WP7中判断图片是否存在

        string mapPath = station.mapPath;
                Uri imageUri = new Uri("/Subway;component/" + mapPath, UriKind.Relative); // mapPath对应图片BuildAction为Resource;  Subway指的是工程名

        // Uri imageUri = new Uri(mapPath, UriKind.Relative); // mapPath对应图片BuildAction为Content
                System.Windows.Resources.StreamResourceInfo sri = Application.GetResourceStream(imageUri);
                if (sri == null)
                {
                    // 图片不存在

                    BrieflyImage.Source = new BitmapImage(new Uri(StaticStrings.DefaultStationPicturePath, UriKind.RelativeOrAbsolute));
                }
                else
                {

           // 图片存在
                    BitmapImage image = new BitmapImage();
                    image.SetSource(sri.Stream);
                    BrieflyImage.Source = image;
                }

  • 相关阅读:
    shell lab
    cache lab
    后缀树
    leetcode maximum-length-of-repeated-subarray/submissions
    leetcode assign-cookies
    lcs
    leetcode delete-operation-for-two-strings
    【C】C语言typedef
    【C】C语言结构体指针的语法
    【JAVA】Java 命令行参数解析
  • 原文地址:https://www.cnblogs.com/crazystars/p/2218346.html
Copyright © 2011-2022 走看看