Russ Dodge
February 12th, 1999, 07:38 PM
How do I get the RGB values from the color dialog box once I've opened it ?
I need to use those values not just the 16 million number value. Thanks
Russ Dodge
February 13th, 1999, 06:55 PM
Never Mind Answered my own question!
Thanks anyway here it is if anyone interested.
Used this formula:
'General Declarations...
Function GetRGB(RGBval As Long, Num As Integer) As Integer
' Check if Num, RGBval are valid.
If Num > 0 And Num -1 And RGBval < 16777216 Then
GetRGB = RGBval \ 256 ^ (Num - 1) And 255
Else:
' Return True (-1) if Num or RGBval are invalid.
GetRGB = True
End If
End Function
'On a Form placed Label object to get color from Commondialog,
'then captured the RGB from the label backcolor...
Private Sub Command1_Click()
CommonDialog1.CancelError = True
CommonDialog1.Flags = &H2 'full open
CommonDialog1.ShowColor
Label1.BackColor = CommonDialog1.Color
Text1 = GetRGB(Label1.BackColor, 1) 'Red
Text2 = GetRGB(Label1.BackColor, 2) 'Green
Text3 = GetRGB(Label1.BackColor, 3) 'Blue
End Sub