Click here to Skip to main content
15,895,777 members
Articles / Programming Languages / C#

Get Known Color from int value

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
17 Nov 2009CPOL 14.2K   1  
if you think Color myColor = Color.FromArgb(0); will give you the known color black, then you are wrong. you need to get it from the colortranlator class. like this:Color c = ColorTranslator.FromWin32(0);So what am i saying ?, is Color.FromArgb(0) not the same as ColorTranslator.FromWin32(

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
20 Nov 2009Ron Beyer
I think you are confusing how the FromArgb method works. It takes a 32 bit number in the format AARRGGBB, where each element of the color is an 8 bit number of the value 0 to 255. Setting the color to zero creates a black color, but it is transparent (the alpha channel is zero). To set black with an

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Denmark Denmark

Comments and Discussions