• 常用方法


    一,获取Mxd地图文档的路径
    /// <summary>
            /// 获取Mxd地图文档的路径
            /// </summary>
            /// <param name="MapControl"></param>
            private string OpenMxFile()
            {
                string mxdFile = "" ;
     
                OpenFileDialog ofd = new OpenFileDialog();
                ofd.InitialDirectory = @"D:Program Files (x86)ArcGISDeveloperKit10.2Samplesdata";
                ofd.Filter = "Map Documents(*.Mxd)|*.mxd";
     
                if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    mxdFile = ofd.FileName;
     
                }
     
                return mxdFile;
            }


    二,获取ShapeFile的路径
    /// <summary>
            /// 获取ShapeFile的路径
            /// </summary>
            /// <returns></returns>
            private string[] OpenShapeFile()
            { 
              string[] ShpFile = new string[2];
              OpenFileDialog ofd = new OpenFileDialog();
              ofd.Title = "打开shp文件";
              ofd.InitialDirectory = @"D:Program Files (x86)ArcGISDeveloperKit10.2Samplesdata";
              ofd.Filter = "Shp文件(*.shp)|*.shp";
     
              if (ofd.ShowDialog()== System.Windows.Forms.DialogResult.OK)
              {
                  string ShapePath = ofd.FileName;
                  
                  //利用"\"将文件路径分成两部分
                  int position = ShapePath.LastIndexOf("\");
                  string filePath = ShapePath.Substring(0,position);
                  string fileName = ShapePath.Substring(position+1);
                  ShpFile[0] = filePath;
                  ShpFile[1] = fileName;
     
              }
     
              return ShpFile;
            }


  • 相关阅读:
    js获取网页屏幕可视区域高度
    vue 一键复制文本内容 clipboard
    uniapp 微信小程序分包优化
    通过vuecli命令行安装uniapp
    微信小程序跳转
    .net session丢失
    验证码识别技术研究(2)
    window环境下安装和卸载服务【转】
    formValidator onshowhtml is not define
    Ajax 跨域请求
  • 原文地址:https://www.cnblogs.com/Robert-huge/p/5855564.html
Copyright © 2020-2023  润新知