I display a balloon callout after casting a axMapControl.Map to a IActiveView and doing this:

pGraphicsContainer = activeView as IGraphicsContainer;
pGraphicsContainer.AddElement(pElement, zOrder); 

The problem is the balloon callout displays below the place labels layer. The text "Minneapolis" is visible on top of my balloon callout. I have tested zOrder with values from -10 to 10000 and the place labels still render on top of the balloon callout.


From the IGraphicsContainer.AddElement documentation:

The parameter zorder is currently not utilized by all of the IGraphicsContainer implementations and is typically set to 0 when calling this method.

You can alter the element z-order using methods like IGraphicsContainer.BringToFront, SendToBack, BringForward and SendBackward. I suppose GetElementOrder and SetElementOrder also serve for this purpose, allowing you to set the z-order at once, but I've never tested.

Anyway, this affects only the z-order of graphic elements, not layer labeling, which is a separate process. Depending on the layer label weight settings, labels draw next to graphic elements (using a placement conflict resolution algorithm) or above them. I remember I was able to tweak this behaviour by creating a separate graphics layer under the map's BasicGraphicsLayer, adding graphic elements to it, and setting this graphic layer's IBarrierProperties.Weight accordingly.

Hope this helps.

  • 1
    Some example code would be exemplary. I can't find the SetElementOrder call and using BringForward hangs the application for some reason. So I would really appreciate an example from anyone. – The Pademelon May 17 '17 at 0:19

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.