예제 #1
0
        private void TOCContextMenuItem_RemoveLayer(object sender, EventArgs e)
        {
            ESRI.ArcGIS.Controls.esriTOCControlItem pItem = ESRI.ArcGIS.Controls.esriTOCControlItem.esriTOCControlItemNone;
            ESRI.ArcGIS.Carto.ILayer    pLayer            = null;
            ESRI.ArcGIS.Carto.IBasicMap pMap = null;
            object pIndex = null;
            object pOther = null;

            TOCControl.GetSelectedItem(ref pItem, ref pMap, ref pLayer, ref pIndex, ref pOther);
            if (pLayer != null)
            {
                MainMap.Map.DeleteLayer(pLayer);
            }
        }
예제 #2
0
        private void TOCContextMenuItem_ZoomToLayer(object sender, EventArgs e)
        {
            esriTOCControlItem pItem  = ESRI.ArcGIS.Controls.esriTOCControlItem.esriTOCControlItemNone;
            ILayer             pLayer = null;
            IBasicMap          pMap   = null;
            object             pIndex = null;
            object             pOther = null;

            TOCControl.GetSelectedItem(ref pItem, ref pMap, ref pLayer, ref pIndex, ref pOther);
            if (pLayer != null)
            {
                IGeoDataset pGeoDataset = pLayer as IGeoDataset;
                MainMap.ActiveView.Extent = pGeoDataset.Extent;
                MainMap.ActiveView.Refresh();
            }
        }