Ife.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Return) Then Dim pFeatureLayer AsIFeatureLayer Dim pCursor AsIFeatureCursor Dim pFilter AsIQueryFilter Dim pFeature AsIFeature pFeatureLayer = Me.AxMapControl1.Map.Layer(0) If NotpFeatureLayer.Name = "states" Then Exit Sub \\ 是地图中的什么属性 是字段还是图层 Me.AxMapControl1.Map.ClearSelection() pFilter = New QueryFilter pFilter.WhereClause = "STATE_NAME ='" & TextBox1.Text & "'" \\ 这个是字段》《? pCursor = pFeatureLayer.Search(pFilter, True) pFeature = pCursor.NextFeature If pFeature Is Nothing Then Me.AxMapControl1.Refresh() MessageBox.Show("没有找到名为" &TextBox1.Text & "的州", "Infomation", MessageBoxButtons.OK) Exit Sub Else Me.AxMapControl1.Map.SelectFeature(pFeatureLayer,pFeature) Me.AxMapControl1.Extent =pFeature.Shape.Envelope End If End If |