CodeItBetter Programming Another VB Programming Blog

How to get the RGB value of a Color

Posted on January 5, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
'Math - How to get the RGB value of a Color

Option Explicit
 
Private Function Red&(ByVal Color&)
    Red = Color And (Not &HFFFFFF00)
End Function
 
Private Function Green&(ByVal Color&)
    Green = (Color And (Not &HFFFF00FF)) \ &H100&
End Function
 
Private Function Blue&(ByVal Color&)
    Blue = (Color And (Not &HFF00FFFF)) \ &HFFFF&
End Function
 
Private Sub Main()
    MsgBox Red(&HFF&) & "," & Green(&HFF&) & "," & Blue(&HFF&)
End Sub
Filed under: Math Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.