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

  • 相关阅读:
    六个月的实习
    cookbook学习第二弹
    cookbook学习第一弹
    maketrans translate
    Python strip函数用法小结
    【翻译】How To Tango With Django 1.5.4 第一章
    os相关方法总结
    python基础(一)
    bash快捷键
    Linux基本命令
  • 原文地址:https://www.cnblogs.com/gisoracle/p/12622481.html
Copyright © 2011-2022 走看看