arcmap vba 方便的修改属性的小工具

Private Sub UIButtonControl1_Click()

UIComboBoxControl1.RemoveAll

UIComboBoxControl1.AddItem ("道路扭曲")
UIComboBoxControl1.AddItem ("颜色异常")
UIComboBoxControl1.AddItem ("道路断裂")
UIComboBoxControl1.AddItem ("房屋倒塌")


End Sub
Private Sub UIComboBoxControl1_SelectionChange(ByVal newIndex As Long)

Dim pMxDoc As IMxDocument
Set pMxDoc = Application.Document

Dim pMap As IMap
Set pMap = pMxDoc.FocusMap

Dim pActiveView As IActiveView
Set pActiveView = pMxDoc.FocusMap

Dim pFeatureClass As IFeatureClass
Dim pFLayer As IFeatureLayer


Set pFLayer = pMap.Layer(0)
Set pFeatureClass = pFLayer.FeatureClass


Dim pBasicMap As IBasicMap
Set pBasicMap = pMap

Dim pSelection As ISelection
Set pSelection = pBasicMap.FeatureSelection


 Dim pEnumFeature As IEnumFeature
 Set pEnumFeature = pSelection
 
 pEnumFeature.Reset
 
 Dim pFeature As IFeature
 Set pFeature = pEnumFeature.Next
 
 Dim pFields As IFields
 Set pFields = pFeature.Fields
 
 Dim i As Long
 i = pFields.FindField("ErrorInfo")
 
 pFeature.Value(i) = UIComboBoxControl1.EditText

 pFeature.Store
 
 pActiveView.Refresh

End Sub

你可能感兴趣的:(map)