过程描述
Private Sub MapControl1_OnMouseDown(ByVal button As Long, ByVal shift As Long, ByVal x As Long, ByVal y As Long, ByVal mapX As Double, ByVal mapY As Double)
Dim pMap As IMap
Dim i As Integer
Dim pPoint As IPoint
Set pMap = MapControl1.Map
Set pPoint = MapControl1.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y)
Dim pIdentify As IIdentify
Dim pIDArray As IArray
Dim pFeatIdObj As IFeatureIdentifyObj
Dim pIdObj As IIdentifyObj
Set pIdentify = pMap.Layer(1)
Dim pEnv As IEnvelope
Set pEnv = New Envelope
Set pEnv = MapControl1.ActiveView.Extent
pEnv.Height = 100
pEnv.Width = 100
pEnv.CenterAt pPoint
Set pIDArray = pIdentify.Identify(pEnv)
If Not pIDArray Is Nothing Then
Set pFeatIdObj = pIDArray.Element(0)
Set pIdObj = pFeatIdObj
pIdObj.Flash MapControl1.ActiveView.ScreenDisplay
'消息显示查询目标的信息
MsgBox "Layer:" & pIdObj.Layer.Name & vbNewLine & "Feature:" & pIdObj.Name
Else
MsgBox "No feature identified."
End If
End Sub
本文介绍如何在ArcGIS Engine中实现MapControl点击查询功能,并通过闪烁效果高亮显示查询结果。文中提供了具体的VB.NET代码示例,包括设置地图环境、识别图层元素及消息提示等关键步骤。
2624

被折叠的 条评论
为什么被折叠?



