Is there a way to programmatically add a halo to text elements that are being added to a graphic container?
Here's a sample of my code:
//
// --- Obtani the area of the polygon to get the centroid of it
//
IArea areaOfPolygon = (IArea)polygonEnvelope;
IPoint TextPoint = new PointClass();
TextPoint = areaOfPolygon.Centroid;
//
// --- Create text symbol
//
System.Drawing.Font textDrawFont = new System.Drawing.Font("Arial", 8F, FontStyle.Bold);
ESRI.ArcGIS.Display.ITextSymbol textFontSymbol = new ESRI.ArcGIS.Display.TextSymbolClass() as ESRI.ArcGIS.Display.ITextSymbol;
//
// --- Supply font property values
//
textFontSymbol.Font = ESRI.ArcGIS.ADF.COMSupport.OLE.GetIFontDispFromFont(textDrawFont) as stdole.IFontDisp;
textFontSymbol.Font.Size = 24;
textFontSymbol.Font.Bold = true;
textFontSymbol.Angle = 0.0;
textFontSymbol.Color = rgbTextColor;
//
// --- Text to be added to the graphic container
//
String sPolygonText = "Need Halo around text";
//
// --- Add text element and set properties
//
ITextElement textElement = new TextElementClass();
textElement.Text = sPolygonText;
textElement.Symbol = textFontSymbol;
//
// --- Create element, set property & add to graphic container
//
element = textElement as IElement;
element.Geometry = TextPoint;
//
// --- Cast Element to Element Property in order to give it a name
//
ESRI.ArcGIS.Carto.IElementProperties3 pTextElementProps = element as ESRI.ArcGIS.Carto.IElementProperties3;
pTextElementProps.Name = "OKC_Search";
//
// --- Add graphic text element to graphic container
//
currentGraphicsContainer.AddElement(element, 0);
//
Here's a sample of my code:
//
// --- Obtani the area of the polygon to get the centroid of it
//
IArea areaOfPolygon = (IArea)polygonEnvelope;
IPoint TextPoint = new PointClass();
TextPoint = areaOfPolygon.Centroid;
//
// --- Create text symbol
//
System.Drawing.Font textDrawFont = new System.Drawing.Font("Arial", 8F, FontStyle.Bold);
ESRI.ArcGIS.Display.ITextSymbol textFontSymbol = new ESRI.ArcGIS.Display.TextSymbolClass() as ESRI.ArcGIS.Display.ITextSymbol;
//
// --- Supply font property values
//
textFontSymbol.Font = ESRI.ArcGIS.ADF.COMSupport.OLE.GetIFontDispFromFont(textDrawFont) as stdole.IFontDisp;
textFontSymbol.Font.Size = 24;
textFontSymbol.Font.Bold = true;
textFontSymbol.Angle = 0.0;
textFontSymbol.Color = rgbTextColor;
//
// --- Text to be added to the graphic container
//
String sPolygonText = "Need Halo around text";
//
// --- Add text element and set properties
//
ITextElement textElement = new TextElementClass();
textElement.Text = sPolygonText;
textElement.Symbol = textFontSymbol;
//
// --- Create element, set property & add to graphic container
//
element = textElement as IElement;
element.Geometry = TextPoint;
//
// --- Cast Element to Element Property in order to give it a name
//
ESRI.ArcGIS.Carto.IElementProperties3 pTextElementProps = element as ESRI.ArcGIS.Carto.IElementProperties3;
pTextElementProps.Name = "OKC_Search";
//
// --- Add graphic text element to graphic container
//
currentGraphicsContainer.AddElement(element, 0);
//