This document is archived and information here might be outdated. Recommended version. |
Get ActiveView from ArcMap.
///<summary>Get ActiveView from ArcMap</summary> /// ///<param name="application">An IApplication interface that is the ArcMap application.</param> /// ///<returns>An IActiveView interface.</returns> /// ///<remarks></remarks> public ESRI.ArcGIS.Carto.IActiveView GetActiveViewFromArcMap(ESRI.ArcGIS.Framework.IApplication application) { if (application == null) { return null; } ESRI.ArcGIS.ArcMapUI.IMxDocument mxDocument=application.Document as ESRI.ArcGIS.ArcMapUI.IMxDocument; // Dynamic Cast ESRI.ArcGIS.Carto.IActiveView activeView=mxDocument.ActiveView; return activeView; }
'''<summary>Get ActiveView from ArcMap</summary> ''' '''<param name="application">An IApplication interface that is the ArcMap application.</param> ''' '''<returns>An IActiveView interface.</returns> ''' '''<remarks></remarks> Public Function GetActiveViewFromArcMap(ByVal application As ESRI.ArcGIS.Framework.IApplication) As ESRI.ArcGIS.Carto.IActiveView If application Is Nothing Then Return Nothing End If Dim mxDocument As ESRI.ArcGIS.ArcMapUI.IMxDocument=TryCast(application.Document, ESRI.ArcGIS.ArcMapUI.IMxDocument) ' Dynamic Cast Dim activeView As ESRI.ArcGIS.Carto.IActiveView=mxDocument.ActiveView Return activeView End Function