Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i have a problem.I can set character spacing to a IElement as ITexElement like :

TextSymbolClass pTextSymbol = new TextSymbolClass();
pTextSymbol.CharacterSpacing = 10 ; //etc
((ITextElement)firstElement).Symbol= pTextSymbol;
//firstElement is a Element in map

Now i want to get value of CharacterSpacing when i focus to a ITextElement in Map.But when i used this code below, some thing happen and it break from function and have no exception.

TextSymbolClass pTextSymbol2 = new TextSymbolClass();    
pTextSymbol2 = (TextSymbolClass)((ITextElement)firstElement).Symbol; //break from here    
value=pTextSymbol2.CharacterSpacing ;

So, how can I get the CharacterSpacing value of a Element,can you show me another way to get it.I'm using Arcgis engine 9.3, C# .Thank you so much.

share|improve this question
Put that code in a try catch and see what Exception you get. – Devdatta Tengshe Jun 19 '13 at 3:47
I put that code in try catch and got error,it seem that i can't cast ((ITextElement)firstElement).Symbol to TextSymbolClass. So how can i get CharacterSpacing with another way? – Đỗ Xuân Cường Jun 19 '13 at 4:02
what is the type of firstElement? what is the type of ((ITextElement)firstElement).Symbol? And in ArcObjects, we usually use the Interfaces, not Classes. Can you cast ((ITextElement)firstElement).Symbol to an ITextSymbol? – Devdatta Tengshe Jun 19 '13 at 4:52
firstElement is IElement. And ((ITextElement)firstElement).Symbol is ITextSymbol . So i can cast ((ITextElement)firstElement).Symbol to ITextSymbol but i can't get CharacterSpacing from it – Đỗ Xuân Cường Jun 19 '13 at 6:51

Your Answer


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

Browse other questions tagged or ask your own question.