RGB

From Delphi

Jump to: navigation, search

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

Contents

[edit] Declaration

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

[edit] Parameters

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

[edit] Definition

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


[edit] Example

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

[edit] See also

Personal tools
.