AE+C# 图层中增加相应属性标注

时间:2024-01-06 12:55:14

原文 AE+C# 图层中增加相应属性标注

if (axMapControl1.LayerCount > )
{
IGeoFeatureLayer pGeoFeatureLayer;
ILineLabelPosition pLineLabelPosition;
ILabelEngineLayerProperties pLabelEngineLayerProperties;
IAnnotateLayerProperties pAnnotateLayerProperties; pGeoFeatureLayer = (IGeoFeatureLayer)axMapControl1.get_Layer();
pGeoFeatureLayer.AnnotationProperties.Clear(); pLineLabelPosition = new LineLabelPosition();
pLineLabelPosition.Above = false;
pLineLabelPosition.AtEnd = false;
pLineLabelPosition.Below = false;
pLineLabelPosition.Horizontal = false;
pLineLabelPosition.InLine = true;
pLineLabelPosition.OnTop = true;
pLineLabelPosition.Parallel = true;
pLineLabelPosition.ProduceCurvedLabels = true; ITextSymbol pTextSymbol = new TextSymbol();
IColor pColor = new RgbColor();
pColor.RGB = ;
pTextSymbol.Size = ;
pTextSymbol.Font.Name = "宋体";
pTextSymbol.Color = pColor; pLabelEngineLayerProperties = new LabelEngineLayerProperties() as ILabelEngineLayerProperties;
pLabelEngineLayerProperties.Symbol = pTextSymbol;
pLabelEngineLayerProperties.IsExpressionSimple = true;
pLabelEngineLayerProperties.Expression = "[NAME]";//需要中括号,这里显示NAME字段属性
pLabelEngineLayerProperties.BasicOverposterLayerProperties.LineLabelPosition = pLineLabelPosition; pAnnotateLayerProperties = (IAnnotateLayerProperties)pLabelEngineLayerProperties;
pAnnotateLayerProperties.DisplayAnnotation = true;
pAnnotateLayerProperties.FeatureLayer = pGeoFeatureLayer; pAnnotateLayerProperties.LabelWhichFeatures = esriLabelWhichFeatures.esriAllFeatures;
pAnnotateLayerProperties.WhereClause = ""; pGeoFeatureLayer.AnnotationProperties.Add(pAnnotateLayerProperties);
pGeoFeatureLayer.DisplayAnnotation = true;
axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
}