参考示例代码:C:Program Files (x86)ArcGISDeveloperKit10.1SamplesArcObjectsNetBrushing
核心代码:
//获取Select Tool工具 Type oType = Type.GetTypeFromProgID("esriArcMapUI.SelectTool"); if (oType != null) { m_gSelectTool = Activator.CreateInstance(oType); } // create and initialize SelectTool command ICommand pCommand; pCommand = (ICommand)m_gSelectTool; pCommand.OnCreate(ArcMap.Application); // emulate mouse click for m_gSelectTool ITool pTool; pTool = (ITool)m_gSelectTool; //当前工具的事件与Select Tool的事件绑定,其他事件中处理方式类似 pTool.OnMouseDown(GetButtonCode(arg), Convert.ToInt32(arg.Shift), arg.X, arg.Y); pTool.OnMouseUp(GetButtonCode(arg), Convert.ToInt32(arg.Shift), arg.X, arg.Y); m_bAction = SelectFromGraphics(); // if there's selected graphics then start moving it if (m_bAction == true) { pTool.OnMouseDown(GetButtonCode(arg), Convert.ToInt32(arg.Shift), arg.X, arg.Y); } else { m_gSelectTool = null; }
ProId查询方式:
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/ArcMap_commands/00010000029s000000/
Name And Ids节点 如下图