缺少什么using指令啊!!!!!!
using System;
using System.Windows.Forms;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.SystemUI;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.ADF.BaseClasses;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private ESRI.ArcGIS.Controls.IMapControl3 m_mapControl = null;
private ControlsSynchronizer m_controlsSynchronizer = null;
//TOCControl控件变量
private ITOCControl2 m_tocControl = null;
//TOCControl中Map菜单
private IToolbarMenu m_menuMap = null;
//TOCControl中图层菜单
private IToolbarMenu m_menuLayer = null;
// private IMapControl3 m_MapControl;
private void Form1_Load(object sender, EventArgs e)
{
m_menuMap = new ToolbarMenuClass();
m_menuLayer = new ToolbarMenuClass();
// 添加自定义菜单项到 TOCCOntrol的Map 菜单中
// 打开文档菜单
m_menuMap.AddItem(new [b][/b][size=16px][/size]OpenNewMapDocument(m_controlsSynchronizer), -1, 0, false, esriCommandStyles.esriCommandStyleIconAndText);
// 添加数据菜单
m_menuMap.AddItem(new ControlsAddDataCommandClass(), -1, 1, false, esriCommandStyles.esriCommandStyleIconAndText);
//打开全部图层菜单
m_menuMap.AddItem(new LayerVisibility(), 1, 2, false, esriCommandStyles.esriCommandStyleTextOnly);
// 关闭全部图层菜单
m_menuMap.AddItem(new LayerVisibility(), 2, 3, false, esriCommandStyles.esriCommandStyleTextOnly);
//以二级菜单的形式添加内置的“选择”菜单
m_menuMap.AddSubMenu("esriControls.ControlsFeatureSelectionMenu", 4, true);
// 以二级菜单的形式添加内置的“地图浏览”菜单
m_menuMap.AddSubMenu("esriControls.ControlsMapViewMenu", 5, true);
// 添加自定义菜单项到 TOCCOntrol的图层菜单中
m_menuLayer = new ToolbarMenuClass();
// 添加“移除图层”菜单项
m_menuLayer.AddItem(new RemoveLayer(), -1, 0, false, esriCommandStyles.esriCommandStyleTextOnly);
// 添加“放大到整个图层”菜单项
m_menuLayer.AddItem(new ZoomToLayer(), -1, 1, true, esriCommandStyles.esriCommandStyleTextOnly);
//设置菜单的Hook
m_menuLayer.SetHook(m_mapControl);
m_menuMap.SetHook(m_mapControl);
//pMapControl = (IMapControl2)axMapControl1.Object;
}
}
}
错误 错误 1 未能找到类型或命名空间名称“OpenNewMapDocument”(是否缺少 using 指令或程序集引用?) F:\c#练习\右键菜单\WindowsFormsApplication1\Form1.cs 38 35 WindowsFormsApplication1
------解决方案--------------------
其实这个问题是这样的:
OpenNewMapDocument,这个类需要重新定义,自己写代码,不是缺少引用的问题、
这些代码是用来实现右键菜单的代码,
在网上搜索右键菜单的实现,有好多现成的教程。