This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ESRI.ArcGIS.Snippets > Snippets > Get Map from ArcMap Snippet (ArcObjects .NET 10.4 SDK) |
Get Map from ArcMap.
///<summary>Get Map from ArcMap</summary> /// ///<param name="application">An IApplication interface that is the ArcMap application.</param> /// ///<returns>An IMap interface.</returns> /// ///<remarks></remarks> public ESRI.ArcGIS.Carto.IMap GetMapFromArcMap(ESRI.ArcGIS.Framework.IApplication application) { if (application == null) { return null; } ESRI.ArcGIS.ArcMapUI.IMxDocument mxDocument=((ESRI.ArcGIS.ArcMapUI.IMxDocument)(application.Document)); // Explicit Cast ESRI.ArcGIS.Carto.IActiveView activeView=mxDocument.ActiveView; ESRI.ArcGIS.Carto.IMap map=activeView.FocusMap; return map; }
'''<summary>Get Map from ArcMap</summary> ''' '''<param name="application">An IApplication interface that is the ArcMap application.</param> ''' '''<returns>An IMap interface.</returns> ''' '''<remarks></remarks> Public Function GetMapFromArcMap(ByVal application As ESRI.ArcGIS.Framework.IApplication) As ESRI.ArcGIS.Carto.IMap Dim mxDocument As ESRI.ArcGIS.ArcMapUI.IMxDocument=CType(application.Document, ESRI.ArcGIS.ArcMapUI.IMxDocument) ' Explicit Cast Dim activeView As ESRI.ArcGIS.Carto.IActiveView=mxDocument.ActiveView Dim map As ESRI.ArcGIS.Carto.IMap=activeView.FocusMap Return map End Function