ae保存图层

地图文档操作与保存
public static void OperateMapDoc(AxMapControl axMapC,string path, string strOperateType)
        {
            try
            {

          
            ////定义打开文件对话框
            //OpenFileDialog OpenFileDlg = new OpenFileDialog();
            ////定义保存文件对话框
            //SaveFileDialog SaveFileDlg = new SaveFileDialog();
            //OpenFileDlg.Filter = "地图文档文件(*.mxd)|*.mxd";
            //SaveFileDlg.Filter = "地图文档文件(*.mxd)|*.mxd";
            string strDocFileN = string.Empty;
            
            //判断操作文档地图的类型
            switch (strOperateType)
            {
                case "SaveDoc":
                    {
                        //pMapDocument = new MapDocumentClass();
                        //pMapDocument.Open(path, "");
                        ////判断文档是否为只读文档
                        //if (pMapDocument.get_IsReadOnly(pMapDocument.DocumentFilename) == true)
                        //{
                        //    DevExpress.XtraEditors.XtraMessageBox.Show("此地图文档为只读文档!", "信息提示");
                        //    return;
                        //}
                        //用相对路径保存地图文档
                        //pMapDocument.Save(true, true);
                        IMxdContents pMxdC;
                        pMxdC = axMapC.Map as IMxdContents;
                        IMapDocument pMapDocument = new MapDocumentClass();
                        pMapDocument.New(path);
                        IActiveView pActiveView = axMapC.Map as IActiveView;
                        pMapDocument.ReplaceContents(pMxdC);
                        pMapDocument.Save(true, true);
                        pMapDocument.Close();
                        DevExpress.XtraEditors.XtraMessageBox.Show("保存成功!", "信息提示");
                        break;
                    }
                default:
                    break;
            }
            }
            catch (Exception e)
            {
                DevExpress.XtraEditors.XtraMessageBox.Show(e.Message, "信息提示");
                return;
            }
        }

  

转载于:https://www.cnblogs.com/xianerwonder/p/4325421.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值