Table _searchTable;
   //定义被查找的表
   Column _searchColumn;
   //定义被查找的列,必须是被索引的
   FindResult _result;
   //定义查询结果
   Find find = null;
   //定义查找对象,并实例化为null
   _searchTable = Session.Current.Catalog.OpenTable(@"C:\Program Files\MapInfo\MapXtreme\6.0\Samples\Data\worldcap.TAB");
   //打开被查找的表
   Columns columns = _searchTable.TableInfo.Columns;
   //定义出表的列
   _searchColumn = columns["Capital"];
   //注意此处的Capital是要区分大小写的。指定查找的列
   find = new Find(_searchTable,_searchColumn);
   //实例化查找对象
   find.UseCloseMatches = true;
   //指定如果找不到完全匹配是否返回 "N" 个接近的匹配。
   find.CloseMatchesMax = 6;
   //即上面的 "N"
   FindResult _findResult = find.Search(textBox2.Text.ToString());
   //给出所要查找的目标,返回查找的结果
   MapInfo.Geometry.DPoint dpoint;
   dpoint.x = (double)_findResult.FoundPoint.X;
   dpoint.y = (double)_findResult.FoundPoint.Y;
   mapControl1.Map.Center = dpoint;
   find.Dispose();
   //释放find对象

相关文章:

  • 2021-08-05
  • 2021-11-18
  • 2021-04-01
  • 2021-11-05
  • 2021-05-24
  • 2022-03-09
  • 2021-12-24
猜你喜欢
  • 2022-12-23
  • 2021-10-23
  • 2021-07-31
  • 2022-12-23
  • 2022-12-23
  • 2021-06-25
  • 2022-01-25
相关资源
相似解决方案