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.

With code I've scraped together from various posts on this site, I am able to display a simple balloon callout with text in a standard ArcMap session. Is it possible to add anything more than just text, for example some html or even something like a windows form?

I am aware of HTML popups - but I don't think they will work for my situation. Without getting to verbose here, the point locations and associated content I want to display don't reside in any feature class. Instead, I have an event handler wired up in ArcMap listening to an external source that invokes the handler with point location & content.

Any thoughts or suggestions?

IMxDocument mxDoc = (IMxDocument)m_application.Document;
IActiveView activeView = mxDoc.ActiveView as IActiveView;
ITextElement pTextElement;
IElement pElement;
ICallout pCallout;
IFormattedTextSymbol pTextSymbol;
IGraphicsContainer pGraphicsContainer;

IPoint anchorPoint = new Point();
anchorPoint.PutCoords(0, 0);

pTextElement = new TextElementClass();
pElement = pTextElement as IElement;
pTextElement.Text = "HELLO WORLD!!!!!!!!!!!!!!!!";

ESRI.ArcGIS.Display.IScreenDisplay screenDisplay = activeView.ScreenDisplay;
ESRI.ArcGIS.Display.IDisplayTransformation displayTransformation = screenDisplay.DisplayTransformation;

int x, y;
displayTransformation.FromMapPoint(anchorPoint, out x, out y);
IPoint messagePoint = displayTransformation.ToMapPoint(x, y - 100);
pElement.Geometry = messagePoint;

pTextSymbol = new ESRI.ArcGIS.Display.TextSymbol();
pCallout = new BalloonCallout();
pTextSymbol.Background = pCallout as ITextBackground;
pCallout.AnchorPoint = anchorPoint;
pTextElement.Symbol = pTextSymbol;

pGraphicsContainer = activeView as IGraphicsContainer;
pGraphicsContainer.AddElement(pElement, 0);
pElement.Activate(activeView.ScreenDisplay);
activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, pElement, null);
share|improve this question
add comment

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.