HighLight selected features

高亮顯示被選中feature,并可控制非選擇feature顯示或隱藏...

使用IQueryFilter過濾選擇集,利用IFeatureSelection.SelectionSymbol設置被選擇要素的外觀。

IFeatureLayerDefinition.DefinitionExpression用于控制圖層上的要素顯示狀態。

Private   Sub SearchSlope(pLayer As ILayer, strSlopes As String, chkfilterValue As Boolean)
 
    
Dim pFeaturelayer As IFeatureLayer
    
Set pFeaturelayer = pLayer
    
    
Dim pFeatureSelection As IFeatureSelection
    
Set pFeatureSelection = pFeaturelayer
    
    
Dim pDefFeatLayer As IFeatureLayerDefinition
    
Set pDefFeatLayer = pFeaturelayer
    
If chkfilterValue = True Then
        pDefFeatLayer.DefinitionExpression 
= "SLOPENO IN (" & strSlopes & ")"
    
Else
        pDefFeatLayer.DefinitionExpression 
= ""
    
End If
    
    
Dim pFilter As IQueryFilter
    
Set pFilter = New QueryFilter
    pFilter.WhereClause 
= "SLOPENO IN (" & strSlopes & ")"

    
Dim pFillSym As ISimpleFillSymbol
    
Set pFillSym = New SimpleFillSymbol

    pFillSym.Style 
= esriSFSDiagonalCross
    pFeatureSelection.SetSelectionSymbol 
= True

    
Set pFeatureSelection.SelectionSymbol = pFillSym

    pFeatureSelection.SelectFeatures pFilter, esriSelectionResultNew, 
False

 
End Sub

 

你可能感兴趣的:(select)