非静态的字段、方法或属性“ESRI.ArcGIS.Controls.IMapControlDefault.ActiveView.get”要求对象引用

利用VS和ArcEngine想要写出一段代码,实现导出地图为图片的功能,以下是我在网络上找到可以实现该功能的代码,却出现了问题


```     private void 导出图片ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SaveFileDialog m_save = new SaveFileDialog();
            m_save.Filter = "jpeg图片(*.jpg)|*.jpg|tiff图片(*.tif)|*.tif|bmp图片(*.bmp)|*.bmp|emf图片(*.emf)|*.emf|png图片(*.png)|*.png|gif图片(*.gif)|*.gif";
            m_save.ShowDialog();
            string Outpath = m_save.FileName;
            if (Outpath != "")
            {
                //分辨率
>                 double resulotion =**_MapControl.ActiveView_**.ScreenDisplay.DisplayTransformation.Resolution;
                IExport m_export = null;
                if (Outpath.EndsWith(".jpg"))
                {
                    m_export = new ExportJPEG() as IExport;

                }
                else if (Outpath.EndsWith(".tig"))
                {
                    m_export = new ExportTIFF() as IExport;

                }
                else if (Outpath.EndsWith(".bmp"))
                {
                    m_export = new ExportBMP() as IExport;

                }
                else if (Outpath.EndsWith(".emf"))
                {
                    m_export = new ExportEMF() as IExport;
                }
                else if (Outpath.EndsWith(".png"))
                {
                    m_export = new ExportPNG() as IExport;
                }
                else if (Outpath.EndsWith(".gif"))
                {
                    m_export = new ExportGIF() as IExport;
                }
                //设置输出的路径
                m_export.ExportFileName = Outpath;
                //设置输出的分辨率
                m_export.Resolution = resulotion;
                tagRECT piexPound;
                piexPound = **_MapControl.ActiveView_**.ScreenDisplay.DisplayTransformation.get_DeviceFrame();
                IEnvelope m_envelope = new Envelope() as IEnvelope;
                m_envelope.PutCoords(piexPound.left, piexPound.bottom, piexPound.right, piexPound.top);
                //设置输出的IEnvelope
                m_export.PixelBounds = m_envelope;

                ITrackCancel m_trackCancel = new CancelTracker();
                //输出的方法
                **_MapControl.ActiveView_**.Output(m_export.StartExporting(), (short)resulotion, ref piexPound, **_MapControl.ActiveView_**.Extent, m_trackCancel);
                m_export.FinishExporting();
            }
        }
四个问题,都是MapControl.ActiveView的问题,代码中已加粗斜体显示,问题一致是“非静态的字段、方法或属性“ESRI.ArcGIS.Controls.IMapControlDefault.ActiveView.get”要求对象引用”的问题。
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问