当前位置: 首页>>代码示例>>C#>>正文


C# Find.Search方法代码示例

本文整理汇总了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();
            }
        }
开发者ID:rupeshkumar399,项目名称:seemapcell,代码行数:49,代码来源:WebForm1.aspx.cs


注:本文中的Find.Search方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。