Select to view content in your preferred language

BalloonCallout Samples for ArcEngine 10?

406
2
12-19-2011 08:27 AM
GeorgeFaraj
Frequent Contributor
Are there any samples using the BalloonCallout Class in ArcEngine Desktop 10?

Does anyone know if a BalloonCallout can be used for labeling or is it restricted to annotations only? (A sample of either one would be appreciated.) Does ESRI actually have people on staff that can write applications using their API? Wouldn't it be nice if there was a place you could request samples? Wouldn't it be nice if someone at the company followed these forums?
0 Kudos
2 Replies
NeilClemmons
Honored Contributor
Does anyone know if a BalloonCallout can be used for labeling or is it restricted to annotations only?
Yes, as far as I know you can.  You should be able to get the label properties from IGeoFeatureLayer.AnnotationProperties.  QI over to ILabelEngineLayerProperties and you can set the symbol used for labeling.  When you create the symbol, use a formatted text symbol.  The callout can be applied by setting the IFormattedTextSymbol.Background property.

Does ESRI actually have people on staff that can write applications using their API?
Yes, they do.  All of the ArcGIS Desktop applications are written using the ArcObjects API.  In fact, that's the reason the ArcObjects API was created.

Wouldn't it be nice if there was a place you could request samples?
Nice, yes.  Practical, no.  ESRI provides a pretty good amount of free support for developers already.  You can purchase technical support through a support agreement/contract, although I don't know that you can simply pay them to write a sample.  I think you actually have to have a problem.

Wouldn't it be nice if someone at the company followed these forums?
They do.  Technically these are user forums, meaning users provide all of the participation.  However, there are a handful of ESRI employees who regularly post here.
0 Kudos
GeorgeFaraj
Frequent Contributor
Does anyone know if a BalloonCallout can be used for labeling or is it restricted to annotations only?
Yes, as far as I know you can.  You should be able to get the label properties from IGeoFeatureLayer.AnnotationProperties.  QI over to ILabelEngineLayerProperties and you can set the symbol used for labeling.  When you create the symbol, use a formatted text symbol.  The callout can be applied by setting the IFormattedTextSymbol.Background property.


Did that with this code it has no effect. (It does at least use the font and size supplied.)

    IAnnotateLayerPropertiesCollection annotateLayerPropertiesCollection = geoFeatureLayer.AnnotationProperties;
    ILabelEngineLayerProperties2 labelEngineLayerProperties = new LabelEngineLayerPropertiesClass();
    IFormattedTextSymbol textSymbol = new TextSymbolClass();
    stdole.IFontDisp font = textSymbol.Font;
    font.Name = fontName;
    font.Size = (decimal)fontSize;
    font.Bold = isBold;
    textSymbol.Font = font;
    textSymbol.Color = fontColor;
    ISimpleFillSymbol fillSymbol = new SimpleFillSymbolClass();
    fillSymbol.Color = Local.ColorToIColor( Color.BlanchedAlmond );
    IBalloonCallout balloonCallout = new BalloonCalloutClass();
    balloonCallout.LeaderTolerance = 0; // must be > 0 to see balloon!
    balloonCallout.Style = esriBalloonCalloutStyle.esriBCSRoundedRectangle;
    balloonCallout.Symbol = fillSymbol;
    textSymbol.Background = balloonCallout as ITextBackground;
    labelEngineLayerProperties.Symbol = textSymbol;
    annotateLayerPropertiesCollection.Add( annotateLayerProperties );

That is why I'd like to see a sample. It was pretty easy to figure that out but it seems that the callout is being completely ignored. 

(After experimenting a little more I see the problem is with the "LeaderTolerance" property.  A value of zero does not automatically draw a leader where it is required - it just turns the balloon off.)

I include the code and comment here for the next poor soul.
0 Kudos