Ejemplo n.º 1
0
        /// <summary>
        /// 创建查看更多符号的右键菜单
        /// </summary>
        /// <returns></returns>
        private ContextMenuStrip CreateMoreSymbolToMenuStrip()
        {
            var contextMenuStrip = new ContextMenuStrip();

            contextMenuStrip.ItemClicked += contextMenuStripMoreSymbol_ItemClicked;

            var dir       = Path.Combine(ArcGisEnvironment.GetInstallPath(), "Styles"); //var dir = ESRI.ArcGIS.RuntimeManager.ActiveRuntime.Path;
            var filePaths = Directory.GetFiles(dir, "*.ServerStyle");                   //取得菜单项数量

            foreach (var filePath in filePaths)                                         //循环添加其它符号菜单项到菜单
            {
                var text = Path.GetFileNameWithoutExtension(filePath);
                contextMenuStrip.Items.Add(new ToolStripMenuItem
                {
                    Name         = filePath,
                    CheckOnClick = true,
                    Text         = text,
                    Checked      = text == "ESRI"
                });
            }

            //添加“更多符号”菜单项到菜单最后一项
            contextMenuStrip.Items.Add(new ToolStripMenuItem {
                Text = StrAddMoreSymbol, Name = StrAddMoreSymbol
            });
            return(contextMenuStrip);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取ESRI.ServerStyle文件的路径
        /// </summary>
        /// <returns></returns>
        private string GetStylesFilePath()
        {
            var paths = new[]
            {
                Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Styles", "ESRI.ServerStyle"),
                Path.Combine(ArcGisEnvironment.GetInstallPath(), "Styles", "ESRI.ServerStyle"),
                Path.Combine(RuntimeManager.ActiveRuntime.Path, "Styles", "ESRI.ServerStyle"),
            };

            foreach (var path in paths)
            {
                if (File.Exists(path))
                {
                    return(path);
                }
            }
            return(null);
        }