是从下面这一段开始出现问题  上面那一段代码调试是没有问题的
请问问什么这样呢
 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());
            }

解决方案 »

  1.   

    MapDocument如果是类的话,要改成这个类的对象
      

  2.   

    看看 你的ArcGIS 是不是引用完全 地图方法和控件是不是引用正确 这几个方法是GIS封装好的  你的错误5把e换成ex就行
      

  3.   

    上面的问题已经解决了  也可以调试  但是我点击Save的时候在红色字体代码那里出现了下面的图片上的错误  是什么原因呢System.ComponentModel;
    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());
                }
            }
        }    }
      

  4.   

    因为少了一段代码,mapDocument还没有和文件相关联