I would like to change the font size for the annotations on an IGeoFeatureLayer. I tried to set it in the lpLabelEngine.Symbol.Font.Size below but the set doesn't persist.

     IGeoFeatureLayer geoLayer = thisLayer as IGeoFeatureLayer;
            if (geoLayer != null)
             geoLayer.DisplayAnnotation = annotationsOn;
            IAnnotateLayerPropertiesCollection propertiesColl = geoLayer.AnnotationProperties;
            IAnnotateLayerProperties labelEngineProperties = new LabelEngineLayerProperties() as IAnnotateLayerProperties;
            IElementCollection placedElements = new ElementCollectionClass();
            IElementCollection unplacedElements = new ElementCollectionClass();
            propertiesColl.QueryItem(0, out labelEngineProperties, out placedElements, out unplacedElements);
            ILabelEngineLayerProperties lpLabelEngine = labelEngineProperties as ILabelEngineLayerProperties;
            if(geocode != null) lpLabelEngine.Expression = geocode;
            if(annotationLabelColor != null) lpLabelEngine.Symbol.Color = annotationLabelColor; 
            labelEngineProperties.AnnotationMinimumScale = minScale;
            labelEngineProperties.AnnotationMaximumScale = maxScale;
                if (fontsize != null) lpLabelEngine.Symbol.Font.Size = Convert.ToDecimal(fontsize);

Any ideas?

ArcEngine 10, C#, VS2010

1 Answer 1


Usually a Symbol properties are set by value, so I suspect lpLabelEngine.Symbol returns a copy. Try setting an ISymbol variable to lpLabelEngine.Symbol, make your changes, then assign it back. You might also need to do the same with ITextSymbol.Font.

The documentation on this is lacking. The only reliable way I know to determine this is to test your assumption with the = operator. if lpLabelEngine.Symbol != lpLabelEngine.Symbol then you know you need to re-assign.

  • Symbol here returns a reference because it is a get/putref property. The font returns a clone because it is a get/put. ArcObjects only document deviations from this behavior (see help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/…) for a full description of the behavior. Feb 19, 2011 at 6:18
  • Also, I recommend changing the size on ITextSymbol itself rather than the font. The Microsoft stdole.FontDisp object has some odd sizing behavior in some circumstances. Feb 19, 2011 at 6:20
  • @craig great to see you here! I've always been confused about the get/set (dumbell) symbols on the OMD's. It seems like there should be one that has a hollow square on the left to show that you are getting a reference and not a copy. For example IGeoFeatureLayer.Featureclass does not returns a clone of a featureclass, even though it has same get/set as ILabelEngineLayerProperties.Symbol. Feb 22, 2011 at 19:04
  • I've had similar thoughts on the subject of the dumbbell symbols, but the symbols actually come down to what IDL for COM interfaces allows. You have the options of propget, propput, or propputref. The bars on the diagrams are assigned to these. Since there is no propgetref, there is no left hand hollow bell. BTW. IGeoFeatureLayer.FeatureClass and ILabelEngineLayerProperties.Symbol both return references. The issue in this post is that the Font property off ITextSymbol returns a clone. Feb 24, 2011 at 6:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.