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: VB7
Expertise: beginner
Nov 3, 2003

GetGreyScale - Convert a color to greyscale

' Convert a color to greyscale
' Example: Me.BackColor = GetGreyScale(Color.Red)

Function GetGreyScale(ByVal col As Color) As Color
    Dim greyValue As Integer = CType(col.R * 0.3 + col.G * 0.59 + col.B * 0.11, _
        Integer)
    Return Color.FromArgb(greyValue, greyValue, greyValue)
End Function
Marco Bellinaso
 
Comment and Contribute

 

 

 

 

 


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

 

 

Sitemap