|
-
February 12th, 1999, 08:38 PM
#1
rgb
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
-
February 13th, 1999, 07:55 PM
#2
Re: rgb
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|