Hi Guys, is there a way to know the RGB colors of an Hexadecimal Color like &H00C0C0C0& (Gray) ?
Thanks
Printable View
Hi Guys, is there a way to know the RGB colors of an Hexadecimal Color like &H00C0C0C0& (Gray) ?
Thanks
Any help ?
if we knew the RBG from that one hex colour u would probably fidn the patten
just found out, that grey colour = RGB(192, 192, 192)
Can you elaborate please ?Quote:
Originally posted by saracen
if we knew the RBG from that one hex colour u would probably fidn the patten
well maybe there is a pattern that you can use to get the RGB colour from Hex
&H00C0C0C0& = RGB(192, 192, 192
maybe C0 = 192
try doing that with others to 'maybe' find a pattern
There has been a misundersatnding !
Wghat i want to know is how to get the RGB colors of agiven Hexadecimal
E.g. : If a have &H0080C0FF& how can i know it's RGB ?
So
found the pattern, and heres a way to do it.
not the best of ways (theres got to be better)
errr ^^^ about that program, but the &H0080C0FF& stuff in the 1st text box and press the button
then the RGB numbers will appear, and label 4's back colour will change
or to miss out all these textbox's and jump straight to the colour....
opps..
Thanks, it's working greatly. Thank you for your time and support
It's ok... i wanted to know that aswell
What i wanna do. When i write msgbox label1.backcolor, i get -2147483633. how can convert this scary number to R, G and B ?
Your getting that strange number because thats in Dec
use
MsgBox Text5.Text + ", " + Text6.Text + ", " + Text7.Text
with my original code
Yes, i know, But i have 3 seperate RGB colors (R, G and B) and i wanna compare them to backgrounds of controls to see if they match, in this case, i trigger a certain action ....
have you ever tried Msgbox Me.BackColor?
it is a decimal number.
Are the backgrounds of controls in Dec then?
is so y convert them to rgb?
Yes, i think they are. I don't specify them. I open the color dialog then choose a color at design time.Quote:
Originally posted by saracen
Are the backgrounds of controls in Dec then?
is so y convert them to rgb?
When back to runtime, i issue control.backcolor i get these numbers e.g. (-174.....). One more thing, my comparing numbers are RGB.
ok so when you get the decimals to RGB, remember that the colors are represented in decimals, so you would have to convert the RGB values to decimal by using RGB(red,green,blue) and then compare them. get what i mean :rolleyes:
ok - i've lost the plot completely :rolleyes:
ok post what RGB values you have, what decimal values you have, and ill see if i can make sense out of all this.
what do you mena BuggyProgrammer ? Can you expain, how to convert from RGB to the value i get when i display msgbox : control.backcolor ? (-1274.....)
if you form is red, and you are trying to see if you form is red or pink :p ,
if me.backcolor = 255 then '255 is red in decimals, or FF in hex
msgbox "hi"
end if
you can check decimal for hex and it will show the same value
if 255= &HFF& Then MsgBox "255 and &HFF& both means red!"
Wait i'm a little bit lost lost here, this is my situation :
I have let's say three values, 225, 75 and 130 which represents the RGB colors. I want then to compare these to the backcolor of the controls to see if they match with existing controls.
If they do (match) i want to trigger a certain action.
??
This demo will do the Conversion from: Decimal - RGB - Hex.
So take what u need.
(Place a MS Common Dialog Control 6.x on a Form)
VB Code:
'Requires the Common Dialog Control 6.X Component Option Explicit Private Type RGBArray 'Used for both Decimal RGB, and Hex RGB storage R As Variant G As Variant B As Variant End Type Dim hexRGB As RGBArray Dim decRGB As RGBArray Dim decColour As Long 'Temp storage for selected Decimal Colour Private Sub Form_Load() 'Open the Common Dialog Colour Box ' Set Cancel to True CommonDialog1.CancelError = True On Error GoTo ErrHandler 'Set the Flags property CommonDialog1.Flags = cdlCCRGBInit ' Display the Color Dialog box CommonDialog1.ShowColor decColour = CommonDialog1.Color 'Convert the Decimal Colour Value to RGB decRGB.B = Int(decColour / 65536) decRGB.G = Int((decColour - (65536 * decRGB.B)) / 256) decRGB.R = decColour - (65536 * decRGB.B + 256 * decRGB.G) 'Convert the Decimal Colour Values to Hex hexRGB.R = Format(Hex(decRGB.R), "00") hexRGB.G = Format(Hex(decRGB.G), "00") hexRGB.B = Format(Hex(decRGB.B), "00") MsgBox "Red: " & hexRGB.R & " Green: " & hexRGB.G & " Blue: " & hexRGB.B Exit Sub ErrHandler: ' User pressed the Cancel button End Sub
Bruce.
You can use the RGB function to do thisQuote:
Originally posted by rogergho
Wait i'm a little bit lost lost here, this is my situation :
I have let's say three values, 225, 75 and 130 which represents the RGB colors. I want then to compare these to the backcolor of the controls to see if they match with existing controls.
If they do (match) i want to trigger a certain action.
Hope this helps,Code:If Command1.ForeColor = RGB(text1.text,text2.text,text3.text) then ...
thats what i said up there why doesnt he listen to meQuote:
Originally posted by BuggyProgrammer
ok so when you get the decimals to RGB, remember that the colors are represented in decimals, so you would have to convert the RGB values to decimal by using RGB(red,green,blue) and then compare them. get what i mean :rolleyes: