I'm writing a WPF application, in C#, using ArcObjects.

I have an ESRI.ArcGIS.Controls.AxMapControl on my form, and I'm trying to draw some graphics elements on top of it.

The map I'm developing with is a customer-provided mdf of the state of Georgia.

Over the top of this, I need to display some markers and some text. It's taken a while, but I've figured out how to do this, except that the image and the text scales with the map. If it looks good at one zoom, it's way too big or way too small at others.

What I'd like is for the marker and text to be placed at a lat/long, so that it moves as the map is panned, but at a fix size that doesn't change as the map is zoomed in and out.

I'd thought that setting ScaleText = false would solve this for the text, but it doesn't seem to, and I'm not seeing any method for doing this with markers.

My current attempt:

public void addMarker(IMap map, double x, double y, string text, string imagePath)
    var point = new PointClass() {X = x, Y = y};

    var pictureMarkerSymbol = new PictureMarkerSymbolClass
        Size = 15,
        BitmapTransparencyColor = new RgbColorClass
            Red = 0,
            Green = 0,
            Blue = 0

    pictureMarkerSymbol.CreateMarkerSymbolFromFile(esriIPictureType.esriIPictureBitmap, imagePath);

    var markerElement = new MarkerElementClass
        Symbol = pictureMarkerSymbol,
        Geometry = point

    var textElement = new TextElementClass
        Text = text,
        ScaleText = false,
        Symbol = new TextSymbolClass
            XOffset = 40,
            Size = 10

    ((IElement) textElement).Geometry = point;

    (map as IGraphicsContainer)?.AddElement(((IElement)textElement), -1);
    (map as IGraphicsContainer)?.AddElement(((IElement)markerElement), 0);

    (map as IActiveView)?.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);

I recognize that the above is stylistically very different from the usual ESRI examples. I find the typical ESRI example almost unreadable. If you strip the more recent C# syntactic sugar from the above, you get the following, which should (and does, in my testing), behave identically:

public void addMarker(IMap map, double x, double y, string text, string imagePath)
    IPoint point = new PointClass();
    point.X = x;
    point.Y = y;

    IRgbColor rgbColorClass = new RgbColorClass();
    rgbColorClass.Red = 0;
    rgbColorClass.Green = 0;
    rgbColorClass.Blue = 0;

    IPictureMarkerSymbol pictureMarkerSymbol = new PictureMarkerSymbolClass();
    pictureMarkerSymbol.Size = 15;
    pictureMarkerSymbol.BitmapTransparencyColor = rgbColorClass;

    pictureMarkerSymbol.CreateMarkerSymbolFromFile(esriIPictureType.esriIPictureBitmap, imagePath);

    IMarkerElement markerElement = new MarkerElementClass();
    markerElement.Symbol = pictureMarkerSymbol;

    IElement eMarkerElement = (IElement) markerElement;
    eMarkerElement.Geometry = point;

    var textSymbol = new TextSymbolClass();
    textSymbol.XOffset = 40;
    textSymbol.Size = 10;

    var textElement = new TextElementClass();
    textElement.Text = text;
    textElement.ScaleText = false;
    textElement.Symbol = textSymbol;

    IElement eTextElement = (IElement) textElement;
    eTextElement.Geometry = point;

    IGraphicsContainer gcMap = (IGraphicsContainer) map;
    gcMap.AddElement(eTextElement, -1);
    gcMap.AddElement(eMarkerElement, 0);

    IActiveView avMap = (IActiveView) map;
    avMap.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);

Anyone have any ideas how I can make this marker and text draw at a fixed size independent of zoom?

  • If use arcgis tools is an option, feature to outline is capable of converting annotations into polygon feature class – FelixIP Jul 10 '16 at 4:14
  • This is something I need to do in code. – Jeff Dege Jul 11 '16 at 15:37
  • did you try scaletext = true ? Maybe your concept of scaling is backwards. – Kirk Kuykendall Jul 21 '16 at 18:10

Do not know any method to stop IGraphicsContainer from scaling its symbols. Only FeatureLayers have the property ScaleSymbols.

So in your case I would create a point-featurelayer myself in a InMemoryWorkspace and set its property ScaleSymbols to false. Then you could add a feature at the right position. Create a SimpleRendererClass for the layer and set your MarkerSymbol for it. For the text it is a bit complicate, you have to set the AnnotationProperties of the layer. Therefore you create a LabelEngineLayerPropertiesClassand set your Textsymbol for its property Symbol A bit help in creating labels you could find here.

| improve this answer | |

Faced similar siutation and resolved using ScaleText option.

ITextSymbol pTextSymbol = new TextSymbolClass();
pTextSymbol.Size = Convert.ToDouble(size);
pTextSymbol.Font = pFontDisp;
pTextSymbol.HorizontalAlignment = esriTextHorizontalAlignment.esriTHACenter;
pTextSymbol.VerticalAlignment = esriTextVerticalAlignment.esriTVACenter;
pTextElement.ScaleText = true;
| improve this answer | |

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.