标题:layer.keyfield问题
只看楼主
lru52777
Rank: 1
来 自:江苏
等 级:新手上路
帖 子:26
专家分:0
注 册:2011-6-7
结帖率:50%
 问题点数:0 回复次数:1 
layer.keyfield问题
没分了,不好意思哈...
问题见代码里红色的部分...
程序代码:
public static string GetNearestPoint(AxMap axMap, string LayerName, double x, double y)
        {
            try
            {
                Features features;
                float radius = 100f;
                int num2 = 0;
                do
                {
                    features = SearchLayerFeature(axMap, x, y, LayerName, radius);
                    radius *= 2f;
                    num2++;
                }
                while ((features.Count <= 0) && (num2 < 5));
                string keyValue = "";
                double num3 = 0.0;
                for (int i = 1; i < (features.Count + 1); i++)
                {
                    double num5 = axMap.Distance(x, y, features.Item(i).CenterX, features.Item(i).CenterY);
                    if ((i == 1) || (num5 < num3))
                    {
                        features.Item(1).Layer.KeyField = "Address";//在执行这句的时候,就会出现异常,这里是什么问题呢????????
                        keyValue = features.Item(i).KeyValue;
                        features.Item(i).Layer.KeyField = "Name";
                        keyValue = keyValue + features.Item(i).KeyValue;
                        num3 = num5;
                    }
                }
                if (!"".Equals(keyValue))
                {
                    keyValue = keyValue + Math.Round(num3, 0).ToString() + "米," + Math.Round(num3, 0).ToString();
                }
                return keyValue;
            }
            catch
            {
                return string.Empty;
            }
        }
哪位大哥给点提示呢?谢谢O(∩_∩)O~
2011-06-16 16:14
lru52777
Rank: 1
来 自:江苏
等 级:新手上路
帖 子:26
专家分:0
注 册:2011-6-7
得分:0 
搞定了...
2011-06-20 14:17



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-343068-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.132008 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved