RGB Function


RGB Function

Class

Microsoft.VisualBasic.Information

Syntax

     Dim result As Integer = RGB(red, green, blue) 


red (required; Integer)

A number between 0 and 255, inclusive


green (required; Integer)

A number between 0 and 255, inclusive


blue (required; Integer)

A number between 0 and 255, inclusive

Description

The RGB function returns a system color code, with combined red, green, and blue components, that can be assigned to object color properties.

Usage at a Glance

  • The RGB color value represents the relative intensity of the red, green, and blue components of a pixel that produces a specific color on the display.

  • The RGB function assumes any argument greater than 255 to be 255.

  • The following table demonstrates how the individual color values combine to create certain colors:

    Color

    Red

    Green

    Blue

    Black

    0

    0

    0

    Blue

    0

    0

    255

    Green

    0

    255

    0

    Red

    255

    0

    0

    White

    255

    255

    255


  • The RGB value is calculated using the following formula:

         RGB = red + (green * 256) + (blue * 65536) 

  • Visual Basic now contains a wide range of intrinsic color constants that can be used to assign colors directly to the color properties of objects. These colors are members of the System.Drawing.Color structure.

See Also

QBColor Function




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net