RGB()
This function takes values for the red, green and blue components of a color and returns the unique number for that color. Because Visual FoxPro offers more than 16 million colors, RGB() is a lot more convenient than trying to remember individual color numbers.
Usage |
nColorNumber = RGB( nRedValue, nGreenValue, nBlueValue ) |
nBlueValue * (256^2) + nGreenValue * 256 + nRedValueWe can't figure why they did it backwards, but we suspect it wasn't the Visual FoxPro developers who made this choice.The header file that ships with FoxPro, FoxPro.H, includes values for 16 colors—use those when you can. (COLOR_RED is a lot more readable than RGB(255,0,0) or 255.) When you need a color other than those 16, use RGB() unless you want the user to choose, in which case use GETCOLOR().The SET COLOR OF SCHEME command uses a special version of RGB() that takes six numbers and converts them into a color pair—that's a foreground and a background color.
Example |
ThisForm.BackColor = RGB(128,0,64) |
See Also |
#Include, BackColor, FoxTools, ForeColor, GetColor(), RGBScheme(), Set Color Of Scheme |