Reputation: 2556
I've got a fairly simple problem (I hope):
I have a color:
Color c = Color.FromArgb(100, 150, 200);
And now I want to store say the R-Value of this color in an integer.
I tried to find this on google but I didn't really know what to search for. So I hope anyone can tell hwhat I need here.
Thank you in advance
Upvotes: 0
Views: 4411
Reputation: 642
Is this what you need ?
RGBA (255, 255, 255, 255) = rgba( 1.0, 1.0, 1.0, 1.0) = 0xFFFFFFFF
Color.R = Color.G = Color.B = Color.A = 255 = 1.0 = 0xff
Upvotes: 0
Reputation: 700152
The R
, G
and B
properties gives you the color components of the Color
value. The compontent values are bytes, so you can assign one to an int
variable without problems:
Color c = Color.FromArgb(100, 150, 200);
int red = c.R; // will be 100
Upvotes: 1