AnsweredAssumed Answered

Fail when updating ITextElement.Symbol

Question asked by charlie_lam on Jul 22, 2014
Latest reply on Sep 9, 2015 by SBhutada-esristaff

Hi all,


I was trying to add halo effect to an annotation layer, when I was trying to updating the symbol properties of ITextElement, the following error prompted:


System.Runtime.InteropServices.COMException (0x80004005):

Error HRESULT E_FAIL has been returned from a call to a COM component.

at ESRI.ArcGIS.Carto.ITextElement.set_Symbol(ITextSymbol Symbol


I have no clue on what I've done wrong. Anyone can help me to find out what's the problem? any suggestion will be appreciated.


TextElement pTextElement = pAnnoFeat.Annotation as TextElement; ITextElement pElmt = pTextElement as ITextElement; ITextSymbol pTextSym = pElmt.Symbol;   // simple line symbol ISimpleLineSymbol pLineSym = new SimpleLineSymbol(); pLineSym.Style = esriSimpleLineStyle.esriSLSNull;   // Fill symbol  IFillSymbol pFillSymbol = new SimpleFillSymbol(); pFillSymbol.Outline = pLineSym; pFillSymbol.Color = Converter.ToRGBColor(Color.Blue);   // IMask IMask pMask = pTextSym as IMask; pMask.MaskSize = 10; pMask.MaskStyle = esriMaskStyle.esriMSHalo; pMask.MaskSymbol = pFillSymbol;  pTextSym = pMask as ITextSymbol; pElmt.Symbol = pTextSym;            // <-- this is where error occurred pAnnoFeat.Annotation = pElmt as IElement;