Exemplo n.º 1
0
        // ArcGIS Snippet Title:
        // Get Contents View from ArcMap
        //
        // Long Description:
        // Get the Contents View (TOC) for ArcMap.
        //
        // Add the following references to the project:
        // ESRI.ArcGIS.ArcMapUI
        // ESRI.ArcGIS.Framework
        // ESRI.ArcGIS.System
        //
        // Intended ArcGIS Products for this snippet:
        // ArcGIS Desktop (ArcEditor, ArcInfo, ArcView)
        //
        // Applicable ArcGIS Product Versions:
        // 9.2
        // 9.3
        // 9.3.1
        // 10.0
        //
        // Required ArcGIS Extensions:
        // (NONE)
        //
        // Notes:
        // This snippet is intended to be inserted at the base level of a Class.
        // It is not intended to be nested within an existing GetIntersection.
        //

        ///<summary>Get the Contents View (TOC) for ArcMap.</summary>
        ///
        ///<param name="application">An IApplication interface that is the ArcMap application.</param>
        ///<param name="index">A System.Int32 that is the tab number of the TOC. When specifying the index number: 0 = usually the Display tab, 1 = usually the Source tab.</param>
        ///
        ///<returns>An IContentsView interface.</returns>
        ///
        ///<remarks></remarks>
        public ESRI.ArcGIS.ArcMapUI.IContentsView GetContentsViewFromArcMap(ESRI.ArcGIS.Framework.IApplication application, System.Int32 index)
        {
            if (application == null || index < 0 || index > 1)
            {
                return(null);
            }
            ESRI.ArcGIS.ArcMapUI.IMxDocument   mxDocument   = (ESRI.ArcGIS.ArcMapUI.IMxDocument)(application.Document); // Explicit Cast
            ESRI.ArcGIS.ArcMapUI.IContentsView contentsView = mxDocument.get_ContentsView(index);                       // 0 = usually the Display tab, 1 = usually the Source tab

            return(contentsView);
        }