protected virtual void OnZoom(ZoomEventArgs e) { if (Zoom != null) { // Invokes the delegates. Zoom(this, e); } }
private void _form_Zoom(object sender, ZoomEventArgs e) { IMap theMap = null; try { if (this._selectedErrors != null && this._selectedErrors.Length > 0) { theMap = this.Extension.FocusMap; IEnvelope theNewExtent = null; for (int i = 0; i < this._selectedErrors.Length; i++) { IPoint thePoint = (IPoint)((IClone)this._selectedErrors[i].Error.Location).Clone(); IEnvelope theEnv = this.ConstructViewEnvAtPoint(thePoint, e.ExtentSize); theEnv.Project(theMap.SpatialReference); if (theNewExtent == null) theNewExtent = theEnv; else theNewExtent.Union(theEnv); } IActiveView theAV = (IActiveView)theMap; theAV.Extent = theNewExtent; theAV.Refresh(); } } catch (Exception ex) { util.Logger.Write("Exception caught zooming the map: " + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace); } finally { if (theMap != null) Marshal.ReleaseComObject(theMap); } }