Balloon Leaders?

322
1
12-27-2011 05:22 AM
GeorgeFaraj
Occasional Contributor III
I run the following code:

public void DrawText( IActiveView view, BalloonParms balloonParms ) {     
    ITextElement textElement = new TextElementClass();     
    textElement.Text = balloonParms.TextString;     
    textElement.ScaleText = true;    
    textElement.Symbol = GetTextBalloon( balloonParms );     
    IElement element = textElement as IElement;     
    element.Geometry = balloonParms.AnchorPoint;     
    view.GraphicsContainer.AddElement( element, 0 );     
    view.PartialRefresh( esriViewDrawPhase.esriViewGraphics, element, null ); 
}
 


(Ignore the details of GetTextBalloon() it is just a standard dance of formatted text, balloon callout, simple fill, and simple line. BalloonParms is just a struct with all the settings bundled.) I'm clicking on a polygon feature, getting the point location, and then calling this code. It works like a charm. But there is no leader line!

What do you have to do with a Balloon Callout to get a Leader to extend from it?  When I use them with Labeling I can muck with the labeling parameters and somehow get Leaders to appear but with a TextElement I don't see how to do that?  Are Balloon Callout Leaders broken?
0 Kudos
1 Reply
JeffreyHamblin
New Contributor III
Hi Charles,

Your line of code:

element.Geometry = balloonParms.AnchorPoint;

sets the position of the balloon text (lower-left corner).

To set the leader line, you need to create another Point for the anchor of the leader line (offset from the text element of course) and assign it to IBalloonCallout.AnchorPoint.

If you are already setting that in your GetTextBalloon() method, then you just need to use a point offset from it for IElement.Geometry.

IOW, the leader won't show unless there is an offset between the two.
0 Kudos