Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Color integer without the Alpha
Message
From
11/04/2008 15:13:09
 
 
To
11/04/2008 13:57:13
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01309975
Message ID:
01310018
Views:
17
>>>Anybody got experience with Colors? I have a database with colors as integers that I need to display the colors. The problem is they are RGB and not ARGB. When I use Color.FromArgb(int) I get a different color. If I try to break out the colors using color.A, color.R, color.G, and color.B I get values in the alpha part that I assume should be 255 if anything.
>>>
>>>The color.FromArgb() method is overloaded to allow me to create a color using only the RGB, but I can't find anything that allows me to extract a matching color from a single 24 bit RGB integer.
>>>Thanks for any help.
>>>Tim
>>
>>I'm assuming the data source is a single int, not an array of ints correct?
>>
>>Just out of curiosity... try RGBx instead of xRGB.
>>
>>Also if the data was created in c a byte array may have been used to create the int so the unused byte may not have been initialized and my contain garbage.
>>
>>Also it may be stored as BGRx or xBGR see http://www.javaworld.com/javaworld/javatips/jw-javatip43.html
>
>I just found the answer; it was there all along.
>Color myColor = System.Drawing.ColorTranslator.FromOle(rgbint);
>
>Works perfect!
>Tim

Cool, glad you found it. BTW... I think VFP uses the xBGR format.

? RGB(1,0,0) = 1
? RGB(0,1,0) = 256
? RGB(0,0,1) = 65536
Previous
Reply
Map
View

Click here to load this message in the networking platform