| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 754 人关注过本帖
标题:非静态的字段、方法或属性“ESRI.ArcGIS.Carto.IMapDocument.DocumentFilen ...
取消只看楼主 加入收藏
巴啦
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2012-12-13
结帖率:0
收藏
 问题点数:0 回复次数:0 
非静态的字段、方法或属性“ESRI.ArcGIS.Carto.IMapDocument.DocumentFilename.get”要求对象引用
请出现这种错误是为什么呢 该如何改正呢


using System;
using System.Collections.Generic;
using
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");
            }
        }
     
        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    非静态的字段、方法或属性“ESRI.ArcGIS.Carto.IMapDocument.DocumentFilename.get”要求对象引用    E:\GIS\作业\arcgis engine\GIS设计\GIS设计\Form1.cs    88    44    GIS设计
错误    2    非静态的字段、方法或属性“ESRI.ArcGIS.Carto.IMapDocument.get_IsReadOnly(string)”要求对象引用    E:\GIS\作业\arcgis engine\GIS设计\GIS设计\Form1.cs    88    17    GIS设计
错误    3    非静态的字段、方法或属性“ESRI.ArcGIS.Carto.IMapDocument.UsesRelativePaths.get”要求对象引用    E:\GIS\作业\arcgis engine\GIS设计\GIS设计\Form1.cs    95    35    GIS设计
错误    4    非静态的字段、方法或属性“ESRI.ArcGIS.Carto.IMapDocument.Save(bool, bool)”要求对象引用    E:\GIS\作业\arcgis engine\GIS设计\GIS设计\Form1.cs    95    17    GIS设计
错误    5    不能在此范围内声明名为“e”的局部变量,因为这样会使“e”具有不同的含义,而它已在“父级或当前”范围中表示其他内容了    E:\GIS\作业\arcgis engine\GIS设计\GIS设计\Form1.cs    98    30    GIS设计
搜索更多相关主题的帖子: 设计 public 如何 
2012-12-13 22:00
快速回复:非静态的字段、方法或属性“ESRI.ArcGIS.Carto.IMapDocument.Document ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.030028 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved