public FrmOverView() { InitializeComponent(); m_OverMap = this.axMapControl.Map; m_GraphContainer = (ESRI.ArcGIS.Carto.IGraphicsContainer)m_OverMap; m_ActiveView = (ESRI.ArcGIS.Carto.IActiveView)m_OverMap; }
/// <summary> /// Get the index number for the specified layer name /// </summary> /// <param name="activeView">An IActiveView interface</param> /// <param name="layerName">A System.String that is the layer name in the active view. Example: "states"</param> /// <returns> /// A System.Int32 representing a layer number. /// Return values of 0 and greater are valid layers. A return value of -1 means the layer name was not found. /// </returns> public static Int32 GetIndexNumberFromLayerName(ESRI.ArcGIS.Carto.IActiveView activeView, System.String layerName) { if (activeView == null || layerName == null) { return(-1); } ESRI.ArcGIS.Carto.IMap map = activeView.FocusMap; // Get the number of layers int numberOfLayers = map.LayerCount; // Loop through the layers and get the correct layer index for (System.Int32 i = 0; i < numberOfLayers; i++) { if (layerName == map.get_Layer(i).Name) { // Layer was found return(i); } } // No layer was found return(-1); }
/// <summary> /// ViewRefreshed Event handler /// </summary> /// <param name="view"></param> /// <param name="phase"></param> /// <param name="data"></param> /// <param name="envelope"></param> /// <remarks></remarks> private void OnActiveViewEventsViewRefreshed(ESRI.ArcGIS.Carto.IActiveView view, ESRI.ArcGIS.Carto.esriViewDrawPhase phase, System.Object data, ESRI.ArcGIS.Geometry.IEnvelope envelope) { // TODO: Add your code here // System.Windows.Forms.MessageBox.Show("ViewRefreshed"); }