Chinaunix首页 | 论坛 | 博客
  • 博客访问: 257270
  • 博文数量: 45
  • 博客积分: 170
  • 博客等级: 入伍新兵
  • 技术积分: 488
  • 用 户 组: 普通用户
  • 注册时间: 2012-09-13 14:43
文章分类

全部博文(45)

文章存档

2014年(2)

2013年(35)

2012年(8)

我的朋友

分类: C#/.net

2013-05-25 20:40:29


点击(此处)折叠或打开

  1. if (axMapControl1.LayerCount > 0)
  2. {
  3.     IGeoFeatureLayer pGeoFeatureLayer;
  4.     ILineLabelPosition pLineLabelPosition;
  5.     ILabelEngineLayerProperties pLabelEngineLayerProperties;
  6.     IAnnotateLayerProperties pAnnotateLayerProperties;

  7.     pGeoFeatureLayer = (IGeoFeatureLayer)axMapControl1.get_Layer(0);
  8.     pGeoFeatureLayer.AnnotationProperties.Clear();

  9.     pLineLabelPosition = new LineLabelPosition();
  10.     pLineLabelPosition.Above = false;
  11.     pLineLabelPosition.AtEnd = false;
  12.     pLineLabelPosition.Below = false;
  13.     pLineLabelPosition.Horizontal = false;
  14.     pLineLabelPosition.InLine = true;
  15.     pLineLabelPosition.OnTop = true;
  16.     pLineLabelPosition.Parallel = true;
  17.     pLineLabelPosition.ProduceCurvedLabels = true;

  18.     ITextSymbol pTextSymbol = new TextSymbol();
  19.     IColor pColor = new RgbColor();
  20.     pColor.RGB = 255;
  21.     pTextSymbol.Size = 8;
  22.     pTextSymbol.Font.Name = "宋体";
  23.     pTextSymbol.Color = pColor;

  24.     pLabelEngineLayerProperties = new LabelEngineLayerProperties() as ILabelEngineLayerProperties;
  25.     pLabelEngineLayerProperties.Symbol = pTextSymbol;
  26.     pLabelEngineLayerProperties.IsExpressionSimple = true;
  27.     pLabelEngineLayerProperties.Expression = "[NAME]";//需要中括号,这里显示NAME字段属性
  28.     pLabelEngineLayerProperties.BasicOverposterLayerProperties.LineLabelPosition = pLineLabelPosition;

  29.     pAnnotateLayerProperties = (IAnnotateLayerProperties)pLabelEngineLayerProperties;
  30.     pAnnotateLayerProperties.DisplayAnnotation = true;
  31.     pAnnotateLayerProperties.FeatureLayer = pGeoFeatureLayer;

  32.     pAnnotateLayerProperties.LabelWhichFeatures = esriLabelWhichFeatures.esriAllFeatures;
  33.     pAnnotateLayerProperties.WhereClause = "";

  34.     pGeoFeatureLayer.AnnotationProperties.Add(pAnnotateLayerProperties);
  35.     pGeoFeatureLayer.DisplayAnnotation = true;
  36.     axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
  37. }
参考来源:http://blog.csdn.net/suinon/article/details/5705421

阅读(3922) | 评论(0) | 转发(0) |
0

上一篇:坐标转换

下一篇:C#+AE 添加图形标注

给主人留下些什么吧!~~