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.

Very new to this, so please excuse any ignorant question! I've created a vb.net app to open a published map in ArcReader. Have a few questions...

First, I started with the query attribute sample to find an address, zoom to the point on the map, and flash. I'd like to have a balloon callout display showing the address on the map as well.

From this site, I tried the following code (below), but trying to use ICallout and IFormattedText Symbol tells me 'ambiguously defined for esri.ArcGIS.Display'.

I'm using ArcReaderControl to build this and then adding on to it. Have I missed something simple?

Thank you very much for any help you have!

DonnaB

Private Sub AddBalloonCallout(ByVal activeView As IActiveView, ByVal text As String, ByVal x As Double, ByVal y As Double)

    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


    Dim pCallout As ICallout
    pTextSymbol = New ESRI.ArcGIS.Display.TextSymbol



    '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 & text

    '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 ESRI.ArcGIS.Geometry.Point
    pPoint.PutCoords(midX, midY)
    pElement.Geometry = pPoint

    'Set the text element symbology to a default balloon callout 
    pTextSymbol = New ESRI.ArcGIS.Display.TextSymbol
    pCallout = New BalloonCallout
    pTextSymbol.Background = CType(pCallout, ITextBackground)

End Sub
share|improve this question

1 Answer 1

////////////////////////////////balloon callout formatting init//////////////////////////
IBalloonCallout balloonCallout = new BalloonCalloutClass();
pTextElement = new TextElementClass();
pFormattedTextSymbol = new TextSymbol() as IFormattedTextSymbol;
TextSymbolClass textSymbolclass = new TextSymbolClass();
textSymbolclass.Background = balloonCallout as ITextBackground; //the bare minimum
balloonCallout.Style = esriBalloonCalloutStyle.esriBCSRoundedRectangle;
balloonCalloutTextSymbol = textSymbolclass as ITextSymbol;
balloonCalloutTextSymbol.Font = ESRI.ArcGIS.ADF.Connection.Local.Converter.ToStdFont(new Font("Arial", 10.0f, System.Drawing.FontStyle.Regular));
////////////////////////////////balloon callout formatting init//////////////////////////

ISymbol thissymbol = balloonCalloutTextSymbol as ISymbol;//textsymbol was init'd to a balloon callout above
object thisobj = thissymbol as object;
mapControl.DrawText(displayPoint, someTextString, ref thisobj);

//I'm using ArcReaderControl to build this and then adding on to it. Have I missed something simple?

I don't find it simple or intuitive at all

share|improve this answer

Your Answer

 
discard

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