Export (0) Print
Expand All

Color.MakeARGB method

Applies to: desktop apps only

The Color::MakeARGB method creates a 32-bit value that consolidates the specified alpha, red, green, and blue components.

Syntax

static MakeARGB(
  [in]  BYTE a,
  [in]  BYTE r,
  [in]  BYTE g,
  [in]  BYTE b
);

Parameters

a [in]

Type: BYTE

Byte that specifies the alpha component.

r [in]

Type: BYTE

Byte that specifies the red component.

g [in]

Type: BYTE

Byte that specifies the green component.

b [in]

Type: BYTE

Byte that specifies the blue component.

Return value

Type:

Type: static

This method returns an ARGB value that holds the specified alpha, red, green, and blue components.

Examples

The following example creates an ARGB value from four BYTE values and then creates a Color object based on that ARGB value. Then the code uses the Color object to fill a rectangle.


VOID Example_MakeARGB(HDC hdc)
{
   Graphics graphics(hdc);

   // Declare and initialize color component values as BYTE types.
   BYTE a = 0xFF;
   BYTE r = 0x80;
   BYTE g = 0x80;
   BYTE b = 0xFF;

   // Create an ARGB value from the four component values.
   ARGB argb = Color::MakeARGB(a, r, g, b);

   // Create a Color object from the ARGB value.
   Color argbColor(argb);

   // Create a SolidBrush object with argbColor, and use it to fill a rectangle.
   SolidBrush argbBrush(argbColor);
   graphics.FillRectangle(&argbBrush, Rect(0, 0, 100, 100));
}

Requirements

Minimum supported client

Windows XP, Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Product

GDI+ 1.0

Header

Gdipluscolor.h (include Gdiplus.h)

Library

Gdiplus.lib

DLL

Gdiplus.dll

See also

Color
Color::GetValue
Color::SetFromCOLORREF

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Community Additions

ADD
Show:
© 2014 Microsoft