Wikia

Delphi Programming

RGB

Talk0
2,909pages on
this wiki

The RGB routine/macro converts the red, green, blue values received into a COLORREF, compatible with TColor.

UnitEdit

Windows

DeclarationEdit

COLORREF RGB(
   BYTE bRed,	   // red value parameter
   BYTE bGreen, // green value parameter
   BYTE bBlue	  // blue value parameter
  );

ParametersEdit

All three values can go from 0 to 255 (8 bits, Type Byte).

DefinitionEdit

#define RGB(r, g ,b)  ((DWORD) (((BYTE) (r) | \  
                                ((WORD) (g) << 8)) | \ 
                       (((DWORD) (BYTE) (b)) << 16)))


ExampleEdit

Label1.Font.Color := RGB(30,0,255);

clWhite := Rgb(0,0,0);
clBlack := Rgb(255,255,255);
clGreen := Rgb(0,255,0);

See alsoEdit

Around Wikia's network

Random Wiki