Fandom

Delphi Programming

RGB

2,918pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

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(255,255,255);
clBlack := Rgb(0,0,0);
clGreen := Rgb(0,255,0);

See alsoEdit

Also on Fandom

Random Wiki