Dim Lyr As MapObjects2.MapLayer
Dim tpRec As New MapObjects2.Recordset
Dim tpStr As String
Dim Mypoint As New MapObjects2.Point
Dim keyFieldName As String
' Set Mypoint = New MapObjects2.Point
If CmbMapLayer.Text = "选择图层名称" Or CmbMapLayer.Text = "" Then
Exit Sub
End If
'得到当前图层的关键字段
Dim rs As New ADODB.Recordset
Set rs = gAdoCon.Execute("Select * From DictLayer Where LayerDisplayName='" & CmbMapLayer.Text & "'")
Set Mypoint = mapDisp.ToMapPoint(X, Y)
Set Lyr = Me.mapDisp.Layers(0)
If Lyr Is Nothing Then
Exit Sub
End If
Set tpRec = Lyr.SearchByDistance(Mypoint, 100, "")
If tpRec Is Nothing Then Exit Sub
If Not tpRec.EOF Then
tpStr = ""
Do While Not tpRec.EOF
tpStr = tpRec.Fields("name").Value
tpRec.MoveNext
Loop
End If '
map.ToolTipText = tpStr