Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm looking for a good BalloonCallout example / tutorial / sample. edit: Using C# with ArcEngine 10 edit #2:

What are the main steps when building a balloon callout using ArcObjects in arcengine 10?

Here's what I've tried so far:

This happens in a dynamic data layer

DynamicGlyphFactory dynamicGlyphFactory = (DynamicGlyphFactory)dynamicDisplay;
IDynamicSymbolProperties2 dynamicSymbolProps = dynamicDisplay as IDynamicSymbolProperties2;

IFillSymbol fillSymbol = new SimpleFillSymbolClass();
TextSymbolClass textSymbol = new TextSymbolClass();
IBalloonCallout balloonCallout = new BalloonCalloutClass();

simpleFillSymbol.Color = rgbColor;

dynamicSymbolProps.set_DynamicGlyph(esriDynamicSymbolType.esriDSymbolFill, fillSymbol as IDynamicGlyph);
dynamicSymbolProps.SetColor(esriDynamicSymbolType.esriDSymbolFill, 20f, 20f, 20f, 255);

IDynamicGlyph fillGlyph = dynamicGlyphFactory.CreateDynamicGlyph((ISymbol)fillSymbol);

balloonCallout.AnchorPoint = anchorPoint;
balloonCallout.Style = esriBalloonCalloutStyle.esriBCSOval;
balloonCallout.Symbol = fillSymbol;
balloonCallout.LeaderTolerance = 10;

textSymbol.Background = (ITextBackground)balloonCallout;
dynamicSymbolProps.TextBoxUseDynamicFillSymbol = true; 
IDynamicGlyph glyph = dynamicGlyphFactory.CreateDynamicGlyph((ISymbol)textSymbol);
dynamicSymbolProps.set_DynamicGlyph(esriDynamicSymbolType.esriDSymbolText, glyph);

iDynamicDisplay.DrawText(point, someString);
share|improve this question
    
What development environment are you using? –  Roger D. Sep 9 '10 at 18:52
1  
I'm not certain, but I don't think balloon callouts work with dynamic displays. You might look into using OpenGL via a .NET wrapper. help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/… –  Kirk Kuykendall Sep 10 '10 at 18:43

1 Answer 1

up vote 2 down vote accepted

There is a VBA sample in the ArcDesktop help How to add a balloon callout it should be possible to customize for ArcGIS Engine, Change so that you ues the ActiveView from your MapControl or PagelayoutControl.

Update, code that works in engine:

Private Sub AddBalloonCallout(ByVal activeView As IActiveView)
        Dim pTextElement As ITextElement
        Dim pElement As IElement
        Dim pPoint As IPoint
        Dim pCallout As ICallout
        Dim pTextSymbol As IFormattedTextSymbol
        Dim pGraphicsContainer As IGraphicsContainer
        Dim midX As Double, midY As Double

        'Create a new text element
        pTextElement = New TextElement
        pElement = CType(pTextElement, IElement) 'QI
        pTextElement.Text = "Text callout" & vbCrLf & "In the middle of the screen"

        'Position the new element on the active view's center point
        midX = (activeView.Extent.XMax + activeView.Extent.XMin) / 2
        midY = (activeView.Extent.YMax + activeView.Extent.YMin) / 2
        pPoint = New Point
        pPoint.PutCoords(midX, midY)
        pElement.Geometry = pPoint

        'Set the text element symbology to a default balloon callout
        pTextSymbol = New TextSymbol
        pCallout = New BalloonCallout
        pTextSymbol.Background = CType(pCallout, ITextBackground)
        'Use this formula to get a callout anchor point location
        pPoint.PutCoords(midX - activeView.Extent.Width / 4, midY + activeView.Extent.Width / 20)
        pCallout.AnchorPoint = pPoint
        pTextElement.Symbol = pTextSymbol

        'Add the element to the active view, either the focus Map or PageLayout
        pGraphicsContainer = CType(activeView, IGraphicsContainer)
        pGraphicsContainer.AddElement(pElement, 0)
        pElement.Activate(activeView.ScreenDisplay)

        'Flag the area of the new element for refreshing
        activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, pElement, Nothing)
    End Sub
share|improve this answer
    
Thanks it works :) –  patrick Sep 13 '10 at 15:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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