Home All Groups Group Topic Archive Search About

Alternative use for Color

Author
21 Nov 2006 1:09 PM
guy
Ever needed to get byte values from an integer?

just convert the integer to a color using Color.FromARGB and then use the
A,R,G,B properties

and to do the reverse use Color.FromARGB(A,R,G,B)

It is undoubtedly bad practice but it makes things easy!

guy

Author
21 Nov 2006 2:40 PM
Robinson
"guy" <g**@discussions.microsoft.com> wrote in message
news:42684578-C43B-465C-A364-3EF1CABDBD36@microsoft.com...
> Ever needed to get byte values from an integer?
>
> just convert the integer to a color using Color.FromARGB and then use the
> A,R,G,B properties
>
> and to do the reverse use Color.FromARGB(A,R,G,B)
>
> It is undoubtedly bad practice but it makes things easy!
>
> guy

Err, thanks for the tip, but it's a little obscure.

I can't imagine what the maintenance coder would say in five years time when
he's tweaking my code and comes across something like that.  I'll stick with
the bitconvertor.