AnsweredAssumed Answered

How to refresh displayed labels after setting properties via ArcObjects?

Question asked by AdrianK on Jun 6, 2016
Latest reply on Jun 14, 2016 by AdrianK

I have cobbled together some code to set halos around text labels for a given feature layer in ArcMap. The code work in the sense it sets the relevant properties. The problem I'm having is having the newly formatted labels updated in the display afterwards. The usual IDocument.ActiveView.Refresh doesn't work. I'm sure there is an easy fix. Any suggestions?

 

Cheers

 

public void add_halo(IGeoFeatureLayer fl)
{
IAnnotateLayerPropertiesCollection pAnno = fl.AnnotationProperties;
pAnno.Clear();
IAnnotateLayerProperties labelEngineProperties = new LabelEngineLayerProperties() as IAnnotateLayerProperties;
ILabelEngineLayerProperties pLprop = labelEngineProperties as ILabelEngineLayerProperties;
ITextSymbol pTextSymbol = pLprop.Symbol;
IFillSymbol pMaskFillSymbol;
IRgbColor pMaskFillColor;

 

IMask pMask = (IMask)pTextSymbol;
pMask.MaskStyle = esriMaskStyle.esriMSHalo;
pMask.MaskSize = 2; //  ' halo size;
pMaskFillSymbol = new SimpleFillSymbol();
pMaskFillColor = new RgbColor();
pMaskFillColor.Red = 255;
pMaskFillColor.Green = 255;
pMaskFillColor.Blue = 255;
pMaskFillSymbol.Color = pMaskFillColor;
pMaskFillSymbol.Outline = null;
pMask.MaskSymbol = pMaskFillSymbol;

 

pTextSymbol.Size = 10;
pAnno.Add((IAnnotateLayerProperties)pLprop);

 

fl.DisplayAnnotation = true;
}

 

 

ArcGIS Desktop 10.3

Win 7

VS 2013 Express

Outcomes