Private Sub UIButtonControl2_Click()
Dim app As IApplication
Set app = Application
Dim pMxDocument As IMxDocument
Set pMxDocument = Application.Document
Dim pMap As IMap
Set pMap = pMxDocument.FocusMap
Dim pFeatureLayer As IFeatureLayer
Set pFeatureLayer = pMap.Layer(0)
Dim pFeatureCursor As IFeatureCursor
Set pFeatureCursor = pFeatureLayer.FeatureClass.Search(Nothing, False)
Dim pFeature As IFeature
Set pFeature = pFeatureCursor.NextFeature
Dim pPolygon As IPolygon
Dim geocollection As IGeometryCollection
Dim pRing As IRing
Dim inringcount As Integer
While Not pFeature Is Nothing
Set pPolygon = pFeature.Shape
Set geocollection = pPolygon
If geocollection.GeometryCount > 1 Then
inringcount = inringcount + 1
pMap.SelectFeature pFeatureLayer, pFeature
End If
' If pPolygon.ExteriorRingCount > 1 Then
'pMap.SelectFeature pFeatureLayer, pFeature
' End If
' If pPolygon.ExteriorRingCount = 1 Then
' Set pPointCollection = pPolygon
' Set pRing = pPointCollection
' inringcount = pPolygon.InteriorRingCount(pRing)
' If inringcount > 0 Then
' pMap.SelectFeature pFeatureLayer, pFeature
' End If
' End If
Set pFeature = pFeatureCursor.NextFeature
Wend
Dim pActiveview As iactiveview
Set pActiveview = pMap
pActiveview.Refresh
MsgBox "一共有" & inringcount & "个不规则多边形"
End Sub