根据自己定义颜色(或样式)显示符合条件的feature

来源:互联网 发布:欧洲帅哥知乎 编辑:程序博客网 时间:2024/05/16 08:42
Private Sub UIButtonControl3_Click()
Dim pMxApp As IMxApplication
Set pMxApp = Application
Dim pMxDoc As IMxDocument
Set pMxDoc = Application.Document

Dim pLayer As ILayer
Set pLayer = pMxDoc.SelectedLayer

Dim pRGBColorA As IRgbColor
Set pRGBColorA = New RgbColor
pRGBColorA.Red = 255

Dim pFLayer As IFeatureLayer
Set pFLayer = pLayer

Dim pQFilter As IQueryFilter
Set pQFilter = New QueryFilter
pQFilter.WhereClause = "LEIXING = '水田'"
'我的条件,可以根据自己需要定义

Dim pFeatSelection As IFeatureSelection
Set pFeatSelection = pLayer
pFeatSelection.SelectFeatures pQFilter, esriSelectionResultNew, False
pFeatSelection.SelectionChanged
Set pFeatSelection.SelectionColor = pRGBColorA
'在这里可以利用pFeatSelection.SelectionSymbol来设置样式
pMxDoc.ActiveView.Refresh
End Sub
 
原创粉丝点击