![]() |
This document is archived and information here might be outdated. Recommended version. |
Get MxDocument from ArcMap.
///<summary>Get MxDocument from ArcMap.</summary>
///<param name="application">An IApplication interface that is the ArcMap application.</param>
///<returns>An IMxDocument interface.</returns>
///<remarks></remarks>
public ESRI.ArcGIS.ArcMapUI.IMxDocument GetMxDocumentFromArcMap(ESRI.ArcGIS.Framework.IApplication application)
{
if (application == null)
{
return null;
}
ESRI.ArcGIS.Framework.IDocument document=application.Document;
ESRI.ArcGIS.ArcMapUI.IMxDocument mxDocument=(ESRI.ArcGIS.ArcMapUI.IMxDocument)(document); // Explicit Cast
return mxDocument;
}
'''<summary>Get MxDocument from ArcMap.</summary>
'''<param name="application">An IApplication interface that is the ArcMap application.</param>
'''<returns>An IMxDocument interface.</returns>
'''<remarks></remarks>
Public Function GetMxDocumentFromArcMap(ByVal application As ESRI.ArcGIS.Framework.IApplication) As ESRI.ArcGIS.ArcMapUI.IMxDocument
If application Is Nothing Then
Return Nothing
End If
Dim document As ESRI.ArcGIS.Framework.IDocument=application.Document
Dim mxDocument As ESRI.ArcGIS.ArcMapUI.IMxDocument=CType(document, ESRI.ArcGIS.ArcMapUI.IMxDocument) ' Explicit Cast
Return mxDocument
End Function