private void axTOCControl_OnMouseDown(object sender, ESRI.ArcGIS.Controls.ITOCControlEvents_OnMouseDownEvent e) { ESRI.ArcGIS.Controls.esriTOCControlItem pTOCControlItem = ESRI.ArcGIS.Controls.esriTOCControlItem.esriTOCControlItemNone; //HitTest引用参数定义 ESRI.ArcGIS.Carto.IBasicMap pBasicMap = null; ESRI.ArcGIS.Carto.ILayer pLayer = null; object pObjectOther = null; object pObjectIndex = null; m_TOCControl.HitTest(e.x, e.y, ref pTOCControlItem, ref pBasicMap, ref pLayer, ref pObjectOther, ref pObjectIndex); //确保有项目被选中 if (pTOCControlItem == ESRI.ArcGIS.Controls.esriTOCControlItem.esriTOCControlItemMap) { m_TOCControl.SelectItem(pBasicMap, null); } else { m_TOCControl.SelectItem(pLayer, null); } //对选中的item进行处理 //选中的是Map if (pTOCControlItem == ESRI.ArcGIS.Controls.esriTOCControlItem.esriTOCControlItemMap) { MapInfo pMapInfo = new MapInfo(m_MapControl.Map); propertyGrid1.SelectedObject = pMapInfo; } //layer if (pTOCControlItem == ESRI.ArcGIS.Controls.esriTOCControlItem.esriTOCControlItemLayer) { LayerInfo pLayerInfo = new LayerInfo(pLayer); propertyGrid1.SelectedObject = pLayerInfo; } //Heading if (pTOCControlItem == ESRI.ArcGIS.Controls.esriTOCControlItem.esriTOCControlItemHeading) { MessageBox.Show("Selected Heading"); } //LegendClass if (pTOCControlItem == ESRI.ArcGIS.Controls.esriTOCControlItem.esriTOCControlItemLegendClass) { MessageBox.Show("Selected LegendClass"); } }
private void axTOCControl_OnMouseDown(object sender, ESRI.ArcGIS.Controls.ITOCControlEvents_OnMouseDownEvent e) { }