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.

Here's how it looks when dynamic display is enabled http://iterationx.posterous.com/34293301

Each letter gets its own balloon callout - this is quite annoying and I can't image why anyone would actually want this.

Here's the code I'm using, its in a custom dynamic layer:

public override void DrawDynamicLayer(esriDynamicDrawPhase DynamicDrawPhase, IDisplay iDisplay, IDynamicDisplay iDynamicDisplay) 
{
if (this.m_textGlyph == null)
{
IBalloonCallout balloonCallout = new BalloonCalloutClass();
balloonCallout.Style = esriBalloonCalloutStyle.esriBCSRoundedRectangle; //oval doesn't work 
ITextElement pTextElement = new TextElementClass();
TextSymbolClass textSymbolclass = new TextSymbolClass();
IFormattedTextSymbol balloonCalloutTextSymbol = textSymbolclass as IFormattedTextSymbol;
balloonCalloutTextSymbol.Background = balloonCallout as ITextBackground; 
balloonCalloutTextSymbol.Font = ESRI.ArcGIS.ADF.Connection.Local.Converter.ToStdFont(new Font("Arial", 10.0f, System.Drawing.FontStyle.Regular));
m_textGlyph = dynamicGlyphFactory.CreateDynamicGlyph(balloonCalloutTextSymbol as ISymbol);
}

m_dynamicSymbolProperties.set_DynamicGlyph(esriDynamicSymbolType.esriDSymbolText, m_textGlyph);
dynamicDisplay.DrawText(mousePoint, textToDisplay);

}

edit:

I tried this but it looks the same

ASCIIEncoding ascii = new ASCIIEncoding();
Byte[] encodedBytes = ascii.GetBytes(textToDisplay);
String decodedString = ascii.GetString(encodedBytes);
dynamicDisplay.DrawText(mousePoint, decodedString);

Since I don't think there is going to be an answer, I'll just mention my workaround.

I created a Polygon to represent the Hover balloon, the simplified the geometry and drew text in the middle of it. Then I kept a copy of the Balloon PointCollection in memory, and if the mapscale changes, I used a Transform2D, to move or scale it, depending on which was necessary. The Glyph outline has to be the same as the fill color or you will get weird squares.

share|improve this question
    
what encoding is "textToDisplay"? My guess is that you have 16-bit encoded text and the ArcGIS code wants 8-bit, so the extra padding confuses the renderer. –  mwalker Nov 23 '10 at 18:33
add comment

1 Answer

Try setting the ".Text" property:

(NOTE: untested code)

public override void DrawDynamicLayer(esriDynamicDrawPhase DynamicDrawPhase, IDisplay iDisplay, IDynamicDisplay iDynamicDisplay) 
{
    if (this.m_textGlyph == null)
    {
        IBalloonCallout balloonCallout = new BalloonCalloutClass();
        balloonCallout.Style = esriBalloonCalloutStyle.esriBCSRoundedRectangle; //oval doesn't work 
        ITextElement pTextElement = new TextElementClass();
        TextSymbolClass textSymbolclass = new TextSymbolClass();
        IFormattedTextSymbol balloonCalloutTextSymbol = textSymbolclass as IFormattedTextSymbol;
        balloonCalloutTextSymbol.Background = balloonCallout as ITextBackground; 
        balloonCalloutTextSymbol.Font = ESRI.ArcGIS.ADF.Connection.Local.Converter.ToStdFont(new Font("Arial", 10.0f, System.Drawing.FontStyle.Regular));

        pTextElement.Text = textToDisplay;

        m_textGlyph = dynamicGlyphFactory.CreateDynamicGlyph(balloonCalloutTextSymbol as ISymbol);
    }

    m_dynamicSymbolProperties.set_DynamicGlyph(esriDynamicSymbolType.esriDSymbolText, m_textGlyph);

}

It looks like the ArcEngine is "painting" each character with the balloon callout brush, rather than doing them all at once with a blob of text.

share|improve this answer
    
Thanks for the suggestion but it didn't work –  patrick Nov 29 '10 at 18:01
add comment

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.