在Base Command和Base Tool类库中使用axMapControl1
AxMapControl的命名空间是
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.AXControls;
在Base Command和Base Tool中
先定义变量:
private AxMapControl mAxMapControl = null;
在下面代码后加上以下代码
// TODO: Add other initialization code
IntPtrpHandle=newIntPtr(m_hookHelper.ActiveView.ScreenDisplay.hWnd);
mAxMapControl = System.Windows.Forms.Form.FromHandle(pHandle) as ESRI.ArcGIS.Controls.AxMapControl;//加载
或者不定义变量直接
IntPtr pHandle = new IntPtr(m_hookHelper.ActiveView.ScreenDisplay.hWnd);
AxMapControl axMapControl1 = System.Windows.Forms.Form.FromHandle(pHandle) as AxMapControl;