Sub ClipMapWithGraphic() Dim pMxDocument As IMxDocument Dim pMap As IMap Dim pViewManager As IViewManager Dim pEnumElement As IEnumElement Dim pElement As IElement Dim pActiveView As IActiveView Dim pBorder As IBorder Dim mco As IMapClipOptions Set pMxDocument = Application.Document Set pMap = pMxDocument.FocusMap Set pViewManager = pMap Set pEnumElement = pViewManager.ElementSelection pEnumElement.Reset Set pElement = pEnumElement.Next If pElement Is Nothing Then MsgBox "No element selected" Exit Sub End If If pElement.Geometry.GeometryType = esriGeometryPolygon Then Set pBorder = New SymbolBorder 'Use default line symbol Set mco = pMap mco.ClipType = esriMapClipMapExtent pMap.ClipBorder = pBorder pMap.ClipGeometry = pElement.Geometry Set pActiveView = pMap pActiveView.Refresh End If End Sub
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.