Compartir a través de


RGB( ) Function

Returns a single color value from a set of red, green, and blue color components.

RGB(nRedValue, nGreenValue, nBlueValue)

Parameters

  • nRedValue
    Specifies the intensity of the red color component. nRedValue can range from 0 to 255. Zero is the minimum color intensity; 255 is the maximum color intensity.
  • nGreenValue
    Specifies the intensity of the green color component. nGreenValue can range from 0 to 255.
  • nBlueValue
    Specifies the intensity of the blue color component. nBlueValue can range from 0 to 255.

Remarks

The value returned by RGB( ) can be used to set color properties such as BackColor and ForeColor.

Example

The following example uses RGB( ) to change the background color of a Form to blue.

goMyForm = CREATEOBJECT('FORM')  && Create a form
goMyForm.Show  && Display the form
WAIT WINDOW 'Press a key to change the form color'
goMyForm.BackColor=RGB(0,0,255)  && Change the form background color
WAIT WINDOW 'Press a key to release the form'
RELEASE goMyForm  && Release the form from memory

See Also

GETCOLOR( ) | RGBSCHEME( ) | BackColor, ForeColor Properties