AnsweredAssumed Answered

Extracting color from the layer file (.lyr file).

Question asked by spoddar83 on Aug 6, 2012

My requirement is to read the symbology color from the .lyr file and use those RGB color code to draw graphics on FLEX UI. but while getting the RGB color through IColor interface I am not geting correct values. for example if I set RED color symbology (255,0,0) for the .lyr file then i am getting value 255 i.e. blue from IColor.RGB. if I set Blue color symbology (0,0,255) for the .lyr file then i am getting 16711680 from IColor.RGB i.e. red color.

Please suggest where i am doing wrong.

I have attached two sample layer files along with the mdb data for testing purpose.

IUniqueValueRenderer pUniqueRend = pFRend as IUniqueValueRenderer;
ISymbol psym = pUniqueRend.get_Symbol(pUniqueRend.get_Label(pUniqueRend.get_Value(i).ToString()));

if (psym is MultiLayerFillSymbol)
IMultiLayerFillSymbol pFill = psym as IMultiLayerFillSymbol; {
IColor pColor = pFill.Color;
int rgb = pColor.RGB;

Thanks a lot in advance for your support.