Hi Alfred,
The RGB values come from the colour picker in AutoCAD. When I hover the mouse over colour index 36 it displays the RGBs as 76,38,0.
As I said, the colour I get back from Color.FromRGB(76,38,0) has a colour index of 38. I've tried it with a few other RGB values that I've taken from the colour picker. The RGBs for colour index 42 (165,124,0) give me a colour with index 44. The RGBs for colour index 44(127,95,0) give me a colour with index 46. It seemed to be giving me back a colour with the index of the next colour up on the adjacent row in the colour picker grid. So, I thought I'd see what happened if I tried colour index 38 which is on the top row. The index I got back from the RGBs for 38 (38,19,0) is 28!
The problem I have is that if I am identifying polylines for example, by their RGB values, and I use the colour index, I can't go from RGB to ColourIndex and back to the same RGBs.
It's actually going:
Col1 = Color.FromRGB(76,38,0)
(Col1.ColourIndex is then 38)
Polyline.Color = Col1
Col2 = Color.FromColorIndex(Polyline.ColorIndex)
Col2.R is then 38
Col2.G is then 19
Col2.B is then 0)
The reason for trying to use the index was that our customer wanted to plot monochrome and setting a polyline colour to a colour that's been retrieved using RGB values, means that it still plots in colour even though it does have colour index within the 0-255 range. That's how I discovered the issue.
I'm working around it by using the colour indexes (indices?) from the start so if I want a polyline that represents 'Area A' I set its colourIndex to 36 and then when I programmatically try to determine what the polyline is defining, I look again at its colour index which is 36 (obviously) which I then look up in my database to get back the value 'Area A'
Sorry forgot to say, I've tried different background colours and it makes no difference.
Thanks
Paul