ArcGIS Engine c#如何实现另存为Mxd地图文档的功能,,求代码
我保存的代码是这样的,参考着说一下//保存地图文档privatevoidSave_Click(objectsender,EventArgse){try{//判断pMapD...
我保存的代码是这样的,参考着说一下
//保存地图文档
private void Save_Click(object sender, EventArgs e)
{
try
{
//判断pMapDocument是否为空,
//获取pMapDocument对象
IMxdContents pMxdC;
pMxdC = axMapControl1.Map as IMxdContents;
IMapDocument pMapDocument = new MapDocumentClass();
pMapDocument.Open(axMapControl1.DocumentFilename, "");
IActiveView pActiveView = axMapControl1.Map as IActiveView;
pMapDocument.ReplaceContents(pMxdC);
if (pMapDocument == null) return;
//检查地图文档是否是只读
if (pMapDocument.get_IsReadOnly(pMapDocument.DocumentFilename) == true)
{
MessageBox.Show("本地图文档是只读的,不能保存!");
return;
}
//根据相对的路径保存地图文档
pMapDocument.Save(pMapDocument.UsesRelativePaths, true);
MessageBox.Show("地图文档保存成功!");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
//另存为怎么写
private void menuSaveDoc_Click(object sender, EventArgs e)
{
//另存为地图文档的实现急求代码
} 展开
//保存地图文档
private void Save_Click(object sender, EventArgs e)
{
try
{
//判断pMapDocument是否为空,
//获取pMapDocument对象
IMxdContents pMxdC;
pMxdC = axMapControl1.Map as IMxdContents;
IMapDocument pMapDocument = new MapDocumentClass();
pMapDocument.Open(axMapControl1.DocumentFilename, "");
IActiveView pActiveView = axMapControl1.Map as IActiveView;
pMapDocument.ReplaceContents(pMxdC);
if (pMapDocument == null) return;
//检查地图文档是否是只读
if (pMapDocument.get_IsReadOnly(pMapDocument.DocumentFilename) == true)
{
MessageBox.Show("本地图文档是只读的,不能保存!");
return;
}
//根据相对的路径保存地图文档
pMapDocument.Save(pMapDocument.UsesRelativePaths, true);
MessageBox.Show("地图文档保存成功!");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
//另存为怎么写
private void menuSaveDoc_Click(object sender, EventArgs e)
{
//另存为地图文档的实现急求代码
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询