Click here to Skip to main content
15,884,628 members
Articles / Programming Languages / C#
Tip/Trick

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.1K   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(

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:

C#
Color c = ColorTranslator.FromWin32(0);

So what am i saying ?, is Color.FromArgb(0) not the same as ColorTranslator.FromWin32(0), well it is and it is'nt, its the same color (black), but the color struct is not the same. try it.

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

 
-- There are no messages in this forum --