getting the total RGB value

  • Thread starter Thread starter Jeff Ciaccio
  • Start date Start date
J

Jeff Ciaccio

I would like to get the total rgb value, but this does not seem to work.
Can anybody help me find the values as integers?

playerRGB = (Me.BackColor.Red + Me.BackColor.Green + Me.BackColor.Blue)


Thanks
 
Jeff Ciaccio said:
I would like to get the total rgb value, but this does not seem to
work. Can anybody help me find the values as integers?

playerRGB = (Me.BackColor.Red + Me.BackColor.Green +
Me.BackColor.Blue)

"Does not work" is always not very specific. If the compiler does not throw
an error, you should enable Option Strict first. If it does, replace Red
with R, Green with G and Blue with B.




Armin
 
Jeff said:
I would like to get the total rgb value, but this does not seem to work.
Can anybody help me find the values as integers?

playerRGB = (Me.BackColor.Red + Me.BackColor.Green + Me.BackColor.Blue)


Thanks

The Red, Green and Blue properties are color constants. You want to use
the R, G and B properties to get the color component values.

What is it that you are trying to do? Just adding the color component
values doesn't seem very useful. Perhaps it's the ToArgb method that you
are looking for?
 
I do not want to let the user make the screen too dark (because the font
color is black), and I think that happens when the sum of R + G + B is a low
value, 0 being completely black.

I'm not familiar with the ToArgb method - does it do something similar?

Thanks!
Jeff
 
Jeff said:
I do not want to let the user make the screen too dark (because the
font color is black), and I think that happens when the sum of R + G +
B is a low value, 0 being completely black.

I'm not familiar with the ToArgb method - does it do something similar?

Thanks!
Jeff
ToArgb() returns and Integer value for the Color.

White = -1
Black = -16777216

I'm assuming that all the other colors fall between those two values but
that is a wag (wild ass guess) on my part. The MSDN library online
probably has some more information on it.

Andrew
 
Jeff said:
I do not want to let the user make the screen too dark (because the font
color is black), and I think that happens when the sum of R + G + B is a
low value, 0 being completely black.

I see. What you want is the GetBrightness() method of the Color class.
It returns a float value between 0.0 and 1.0.
I'm not familiar with the ToArgb method - does it do something similar?

No, it returns the color as an integer value, where the alpha, red,
green and blue values are stored sequentially in the bits of the integer.
 
Back
Top