本文整理汇总了C#中Find.Search方法的典型用法代码示例。如果您正苦于以下问题:C# Find.Search方法的具体用法?C# Find.Search怎么用?C# Find.Search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Find
的用法示例。
在下文中一共展示了Find.Search方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindCity
private void FindCity()
{
Find find = null;
try
{
MapInfo.Mapping.Map map = null;
// Get the map
if (MapInfo.Engine.Session.Current.MapFactory.Count == 0 ||
(map = MapInfo.Engine.Session.Current.MapFactory[MapControl1.MapAlias]) == null)
{
return;
}
// Do the find
MapInfo.Mapping.FeatureLayer findLayer = (MapInfo.Mapping.FeatureLayer) map.Layers[_findLayerName];
find = new Find(findLayer.Table, findLayer.Table.TableInfo.Columns[_findColumnName]);
FindResult result = find.Search(DropDownList1.SelectedItem.Text);
if (result.ExactMatch)
{
// Create a Feature (point) for the location we found
CoordSys csys = findLayer.CoordSys;
FeatureGeometry g = new MapInfo.Geometry.Point(csys, result.FoundPoint.X, result.FoundPoint.Y);
Feature f = new Feature(g, new MapInfo.Styles.SimpleVectorPointStyle(52, System.Drawing.Color.DarkGreen, 32));
// Delete the existing find object and add the new one
MapInfo.Mapping.FeatureLayer workingLayer = (MapInfo.Mapping.FeatureLayer)map.Layers[_workingLayerName];
if (workingLayer != null)
{
(workingLayer.Table as ITableFeatureCollection).Clear();
workingLayer.Table.InsertFeature(f);
}
// Set the map's center and zooom
map.Center = new DPoint(result.FoundPoint.X, result.FoundPoint.Y);
MapInfo.Geometry.Distance d = new MapInfo.Geometry.Distance(1000, map.Zoom.Unit);
map.Zoom = d;
}
else
{
this.Label3.Text = ("Cannot find the country");
}
find.Dispose();
}
catch (Exception)
{
if (find != null) find.Dispose();
}
}