Select to view content in your preferred language

How get symbol from style class by name?

474
1
05-18-2011 02:54 AM
AnatoliiTerentiev
Deactivated User
I get symbol from style file in the next way:
ISymbol Sym = (ISymbol)axSymbologyControl1.GetStyleClass(styleClass).GetItem(8).Item;

But how I can get symbol by name? Thanks for any advice!
0 Kudos
1 Reply
SebastianKrings
Frequent Contributor
Hi,

isn't there a method like getItemByName()? Such methods appear more often as far as I know.

Another idea is to map the itemnumber with ne itemname.
For this you have to get a list of itemnames available or iterate until you have found it.

Somthing like this maybe (not functional, just as idea):

string itemName = XXXX;
ISymbol Sym = null;
SytelClass sc = axSymbologyControl1.GetStyleClass(styleClass);
bool found = false;
int i = 0;
while(!found)
{
  if(sc.GetItem(i).Item.Name = itemName)
  {
    found = true;
  }
  else
  {
    i++;
  }
}
0 Kudos