Convert excel Color BGR to RGB

Thursday, July 10, 2014

I found an article saying the value returned by Interior.Color is in BGR and I'm trying to convert it to RGB but I still got weird color


And I'm trying to retrieve a base color in an excel cell to light it usingControlPaint.Light


here is my convert method



public static int BGRToRGB(int bgr)
{
byte[] hexBGR;
byte[] hexRGB = new byte[4] {0,0,0,0};

hexBGR = BitConverter.GetBytes(bgr);

hexRGB[0] = hexBGR[0];
hexRGB[1] = hexBGR[3];
hexRGB[2] = hexBGR[2];
hexRGB[3] = hexBGR[1];

return BitConverter.ToInt32(hexRGB, 0);
}


What am I doing wrong?







http://ift.tt/1k8iwy1