Export (0) Print
Expand All

Color.GetValue method

Applies to: desktop apps only

The Color::GetValue method gets the ARGB value of this Color object.

Syntax

ARGB GetValue();

Parameters

This method has no parameters.

Return value

Type:

Type: ARGB

This method returns a 32-bit ARGB value that holds the alpha, red, green, and blue components of this color. ARGB is defined in Gdipluspixelformats.h.

Examples

The following example creates a Color object, gets an ARGB value that represents the color, and creates a second Color object that uses the same ARGB value. It then fills a rectangle by using a Brush object based on the second color.


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

   // Create a Color object that initializes the ARGB value.
   Color firstColor(255, 128, 128, 255);

   // Get the ARGB value of firstColor.
   ARGB argb = firstColor.GetValue();

   // Create a new Color object with the same ARGB value as firstColor.
   Color secondColor(argb);

   // Create a SolidBrush object with secondColor, and use it to fill a rectangle.
   SolidBrush argbBrush(secondColor);
   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::MakeARGB

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Community Additions

ADD
Show:
© 2015 Microsoft