是从下面这一段开始出现问题 上面那一段代码调试是没有问题的
请问问什么这样呢
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
{
if (MapDocument.get_IsReadOnly(MapDocument.DocumentFilename) == true)
{
MessageBox.Show("地图文档是只读的无法保存");
}
string fileSavePath=@"e:\new.mxd";
try
{
MapDocument .Save(MapDocument .UsesRelativePaths,true );
MessageBox.Show ("保存地图文档成功");
}
catch (Exception e)
{
MessageBox .Show ("保存地图文档失败!!!"+e.ToString());
}
请问问什么这样呢
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
{
if (MapDocument.get_IsReadOnly(MapDocument.DocumentFilename) == true)
{
MessageBox.Show("地图文档是只读的无法保存");
}
string fileSavePath=@"e:\new.mxd";
try
{
MapDocument .Save(MapDocument .UsesRelativePaths,true );
MessageBox.Show ("保存地图文档成功");
}
catch (Exception e)
{
MessageBox .Show ("保存地图文档失败!!!"+e.ToString());
}
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ESRI.ArcGIS.ADF;
using ESRI.ArcGIS.SystemUI;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.Display;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Carto;namespace GIS设计
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void Form1_Load(object sender, EventArgs e)
{ }
private void MainForm_Load(object sender, EventArgs e)
{
// 将主窗体放大到整个屏幕
this.Size = Screen.PrimaryScreen.WorkingArea.Size;
this.Location = new System.Drawing.Point(0, 0); // 将axToolbarControl和axTOCControl与axMapControl2绑定!
axToolbarControl1.SetBuddyControl(axMapControl2); axTOCControl1.SetBuddyControl(axMapControl2); } private void tabControl1_TabIndexChanged(object sender, EventArgs e)
{ } private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
if (tabControl1.SelectedIndex == 0)
{
axToolbarControl1.SetBuddyControl(axMapControl2); axTOCControl1.SetBuddyControl(axMapControl2); }
else
{
axToolbarControl1.SetBuddyControl(axPageLayoutControl1); axTOCControl1.SetBuddyControl(axPageLayoutControl1); }
} private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
System.Windows.Forms.OpenFileDialog openFileDialog;
openFileDialog = new OpenFileDialog();
openFileDialog.Title = "Open";
openFileDialog.Filter = "map documents(*.mxd)|*.mxd";
openFileDialog.ShowDialog();
string filePath = openFileDialog.FileName;
if (axMapControl2.CheckMxFile(filePath))
{
axMapControl2.MousePointer = esriControlsMousePointer.esriPointerHourglass;
axMapControl2.LoadMxFile(filePath, 0, Type.Missing);
axMapControl2.MousePointer = esriControlsMousePointer.esriPointerDefault;
}
else
{
MessageBox.Show(filePath + "no use map");
}
}
IMapDocument mapDocument;
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
{
mapDocument = new MapDocumentClass();
if (mapDocument.get_IsReadOnly(mapDocument.DocumentFilename) == true) {
MessageBox.Show("地图文档是只读的无法保存");
}
try
{
mapDocument .Save(mapDocument .UsesRelativePaths,true );
MessageBox.Show ("保存地图文档成功");
}
catch (Exception ex)
{
MessageBox .Show ("保存地图文档失败!!!"+ex.ToString());
}
}
} }