考博英语词汇书:电子地图MAPX程序解释,要详细的。

来源:百度文库 编辑:中科新闻网 时间:2024/04/24 21:09:19
Private Sub Timer4_Timer()
Dim l1 As MapXLib.Layer
Dim l2 As MapXLib.Features
Dim ftr As Features
Set l1 = Map1.Layers("BuildLayer")
Set ftr = l1.AllFeatures
Map1.Datasets.Add miDataSetLayer, l1
Set l2 = l1.Search("phonenum = """ + Cmbdd.Text + """")
If (flag1) Then
l1.Selection.ClearSelection
flag1 = False
Else
l1.Selection.Replace l2
flag1 = True
End If
End Sub
地图的放大实现代码:
Map1.CurrentTool = miZoomInTool
点击闪烁图元,以该图元为中心放大并显示图元信息:
Select Case ToolNum
Case infoTool
pnt.Set X1, Y1
Set findstr = Map1.Layers("BuildLayer").Find.Search("电教中心", "BuildLayer")
Map1.ZoomTo 0.8, X1, Y1
For Each lyr In Map1.Layers
Set ftrs = lyr.SearchAtPoint(pnt)
If ftrs.Count > 0 Then
strInfo = "layer name:" & lyr.Name & vbCrLf
strInfo = strInfo & "feature name:" & ftrs.Item(1).Name & vbCrLf
Set ds = Map1.Datasets.Add(miDataSetLayer, lyr)
For Each fld In ds.Fields
strInfo = strInfo & fld.Name & ":"
Set lyr.KeyField = fld
strInfo = strInfo & ftrs.Item(1).KeyValue & vbCrLf
Next
MsgBox strInfo
Exit For
End If
Next
If ftrs.Count = 0 Then
MsgBox "没有图元被选中"
End If
End Select
End Sub

嘿嘿~问题不详细,貌似编程问题