Color.GetBlue method

Applies to: desktop apps only

The Color::GetBlue method gets the blue component of this Color object.

Syntax

BYTE GetBlue();

Parameters

This method has no parameters.

Return value

Type:

Type: BYTE

This method returns the blue component of this color.

Examples

The following example creates a Color object, gets the blue component of the color, and creates a second Color object that uses the same blue component. It then fills a rectangle by using a Brush object based on the second color.


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

   // Create a Color object with a blue component value of 255.
   Color firstColor(0, 255, 255, 255);

   // Get the blue component value of firstColor.
   int blue = firstColor.GetBlue();

   // Create a new Color object with the same blue component value as firstColor.
   Color secondColor(255, 0, 0, blue);

   // Create a SolidBrush object with secondColor, and use it to fill a rectangle.
   SolidBrush blueBrush(secondColor);
   graphics.FillRectangle(&blueBrush, 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::GetAlpha
Color::GetB
Color::GetBlue
Color::GetG
Color::GetGreen
Color::GetR
Color::GetRed
Color::GetValue

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Community Additions

ADD
Show: