Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: VB4,VB5,VB6,VBS
Expertise: beginner
Feb 19, 2000

Extract Red,Green,Blue components of a color

If you have a 32-bit color value in RGB format, you can extract its Red, Green and Blue components using the following routines:

Function GetRed(ByVal lColor As Long) As Long
    GetRed = lColor Mod 256
End Function

Function GetGreen(ByVal lColor As Long) As Long
    GetGreen = (lColor \ &H100) Mod 256
End Function

Function GetBlue(ByVal lColor As Long) As Long
    GetBlue = (lColor \ &H10000) Mod 256
End Function

Remember that you can combine the red, green and blue components into a RGB color using the built-in RGB function

rgbColor = RGB(redColor, greenColor, blueColor)
Marco Bellinaso
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date