欢迎来到天天文库
浏览记录
ID:32377958
大小:69.00 KB
页数:3页
时间:2019-02-04
《地图打开和保存》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、Arcgis二次开发实验报告1、实验名称:地图的打开和保存2、实验目的(1)掌握如何对地图的打开和保存功能实现二次开发,将ArcMap中的打开和保存功能进行实现。(2)理解打开地图和保存地图的机理方法,对其实现思路有一个深刻的认识。3、功能分析通过按钮来实现打开和保存地图的功能,通过打开和保存按钮分别可以打开和保存地图,即将ArcMap中菜单条上的打开保存地图功能在按钮上实现。4、实现的核心代码privatevoidloadMapDoc(){mapDocument=newMapDocumentCl
2、ass();try{System.Windows.Forms.OpenFileDialogopenFileDialog;openFileDialog=newOpenFileDialog();openFileDialog.Title="打开地图文档";openFileDialog.Filter="mapdocuments(*.mxd)
3、*.mxd";openFileDialog.ShowDialog();stringfilePath=openFileDialog.FileName;mapDocume
4、nt.Open(filePath,"");for(inti=0;i5、ntFilename)==true){MessageBox.Show("地图文档是只读的无法保存");}stringfileSavePath=@"e:ew.mxd";try{mapDocument.Save(mapDocument.UsesRelativePaths,true);MessageBox.Show("保存地图文档成功");}catch(Exceptione){MessageBox.Show("保存地图文档失败!!!"+e.ToString());}}privatevoidsaveA6、sDocument(){if(mapDocument.get_IsReadOnly(mapDocument.DocumentFilename)==true){MessageBox.Show("地图文档是只读的无法保存");}stringfileSavePath=@"e:ew.mxd";try{mapDocument.SaveAs(fileSavePath,true,true);MessageBox.Show("另存地图文档成功");}catch(Exceptione){MessageBox.S7、how("另存地图文档失败!!!"+e.ToString());}}5、运行结果截图
5、ntFilename)==true){MessageBox.Show("地图文档是只读的无法保存");}stringfileSavePath=@"e:ew.mxd";try{mapDocument.Save(mapDocument.UsesRelativePaths,true);MessageBox.Show("保存地图文档成功");}catch(Exceptione){MessageBox.Show("保存地图文档失败!!!"+e.ToString());}}privatevoidsaveA
6、sDocument(){if(mapDocument.get_IsReadOnly(mapDocument.DocumentFilename)==true){MessageBox.Show("地图文档是只读的无法保存");}stringfileSavePath=@"e:ew.mxd";try{mapDocument.SaveAs(fileSavePath,true,true);MessageBox.Show("另存地图文档成功");}catch(Exceptione){MessageBox.S
7、how("另存地图文档失败!!!"+e.ToString());}}5、运行结果截图
此文档下载收益归作者所有