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

  • 相关阅读:
    docker 删除本地镜像
    hadoop 伪分布环境部署
    docker多镜像+nginx+django环境部署
    docker+django 运行环境部署
    设计数据结构-LRU缓存算法
    设计数据结构-Unionfind并查集算法
    String#intern理解
    java常见API和集合
    链表总结
    二叉树的基础总结
  • 原文地址:https://www.cnblogs.com/gisoracle/p/12622481.html
Copyright © 2011-2022 走看看