zoukankan      html  css  js  c++  java
  • ArcGIS Pro自定义图标

    来自:https://community.esri.com/thread/250077-custom-control-and-handling-images

    Let say in xaml

    <Image x:Name="ImgStatus" Grid.Column="1" Grid.Row="0" Width="32" Height="32" Source="pack://application:,,,/[your name space];component/[folder name if you put your image into the folder]/[your image name].pngVerticalAlignment="Top"></Image>

    In cs file

     private void SetStatus()
            {
                this.ImgStatus.Source = this.BuildImage([Your desire image name]);
            }


    /// <summary>
            /// Create bitmap image source
            /// </summary>
            /// <param name="imageName"></param>
            /// <returns></returns>
            private ImageSource BuildImage(string imageName)
            {
                return new BitmapImage(PackUriForResource(imageName));
            }
            /// <summary>
            /// Create wpf uri, make sure the image type is assembly resource
            /// </summary>
            /// <param name="resourceName"></param>
            /// <returns></returns>
            private Uri PackUriForResource(string resourceName)
            {
                string asm = System.IO.Path.GetFileNameWithoutExtension(
                    System.Reflection.Assembly.GetExecutingAssembly().CodeBase);
                return new Uri(string.Format("pack://application:,,,/{0};component/[Your image folder path]/{1}", asm, resourceName), UriKind.Absolute);
            }

    Make sure you replace those variable with [] properly from the sample code.  and try i

  • 相关阅读:
    Exercise02_09
    Exercise02_05
    Exercise02_01
    Exercise02_03
    Exercise02_07
    web.xml配置详解
    面对不成功的人生
    请不以结婚为目的的恋爱吧
    年轻人能为世界做点什么
    不作就不会活
  • 原文地址:https://www.cnblogs.com/gisoracle/p/12622481.html
Copyright © 2011-2022 走看看