Private Sub Command1_Click() Dim FindObj As MapXLib.Find Dim FoundFeature As FindFeature '从要查询的RTU图层生成Find对象,并为这个对象设置要查询的FindDataSet、FindField属性 Set FindObj = Form1.Map1.Layers.Item(1).Find Set FindObj.FindDataset = Form1.Map1.DataSets("RTU节点" & " dataset") Set FindObj.FindField = FindObj.FindDataset.Fields("RTUName")
Dim FindObj As MapXLib.Find Dim FoundFeature As FindFeature '从要查询的RTU图层生成Find对象,并为这个对象设置要查询的FindDataSet、FindField属性 Set FindObj = Form1.Map1.Layers.Item(1).Find Set FindObj.FindDataset = Form1.Map1.DataSets("RTU节点" & " dataset") Set FindObj.FindField = FindObj.FindDataset.Fields("RTUName")
Set FoundFeature = FindObj.Search(Text1.Text)
If FoundFeature.FindRC Mod 10 = 1 Or FoundFeature.FindRC Mod 10 = 2 Then Me.Hide ' 关掉AutoRedraw是因为CenterX(Y)的改变就要刷新图层,AutoRedraw打开的话会造成二次刷新 Form1.Map1.AutoRedraw = False Form1.Map1.CenterX = FoundFeature.CenterX Form1.Map1.CenterY = FoundFeature.CenterY Form1.Show Else MsgBox "不存在该RTU节点!" End If