Search code examples
c#debuggingesri-arc-engine

A .NET program powered by ArcGIS engine SDK reports that cannot find type or namespace "AxMapControl "


I've got a .NET program powered by ArcGIS engine SDK version 10.2 which aims to check the spatial data. The IDE is Microsoft Visual Studio 2012. I've added all needed references start with ESRI.ARCGIS as well as the namespace,but it still cannot run.I think the namespace ESRI.ARCGIS.Controls should contain the class AxMapControl but it doesn't.What can I do to solve it? Some code is shown below.

using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.DataSourcesRaster;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.SystemUI;
using Geoway.ADF.GIS.OpenDataDialog;
using Geoway.ADF.MIS.Core.Public.interfaces;
using Geoway.ADF.MIS.Core.Public.util;
using Geoway.ADF.MIS.Utility.Core;
using Geoway.ADF.MIS.Utility.Log;
using System;
using System.Collections;
using System.Data;
using System.Globalization;
using System.IO;
using System.Windows.Forms;

namespace Geoway.ADF.GIS.CheckerUI
{
public class MapManager
{
    private AxMapControl m_MapControl;

    private ICommand pControlsMapFullExtentCommand;

    private ICommand pControlsMapPanTool;

    private ICommand pControlsMapZoomInTool;

    private ICommand pControlsMapZoomOutTool;

    private ICommand pControlsMapPreViewCommand;

    private ICommand pControlsMapNextViewCommand;

    public ISimpleCallBack simAxisCallBack;

    public ISimpleCallBack simSelCallBack;

    private NumberFormatInfo nfi4 = ConvertUtil.GetNumFormatInfo(4);

    private ArrayList m_lstFeatureClass;

    private ArrayList m_lstRasterDataset;

    private Form parentForm;

    public AxMapControl MapControl
    {
        get
        {
            if (this.m_MapControl == null)
            {
                this.m_MapControl = new AxMapControl();
            }
            return this.m_MapControl;
        }
        set
        {
            this.m_MapControl = value;
        }
    }

Solution

  • You need to refer to ESRI.ArcGIS.AxControls which Contains the AxMapControl. You can than use Windows Forms controls to be placed on a WPF window or page by using the WindowsFormsHost control, which provides a container where a single Windows Forms control can be hosted.