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~