suniti_11

Need a Textbox inside a Callout where user can enter the Text.

Discussion created by suniti_11 on Mar 14, 2014
Latest reply on Mar 20, 2014 by suniti_11
Hi,

I need Balloon Callout functionality similar to ArcMap(Callout Tool)
The Sample code I am using below is too display a static text.
But I want User to Enter the Text in Callout and as of now I am not able to display a Textbox on top of Callout.

Please find the code below:

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);

Please provide the valuable suggestions.
It would be a great help.

Thanks.

Outcomes