Skip to content

Latest commit

 

History

History
148 lines (96 loc) · 5.47 KB

nf-gdipluspath-pathgradientbrush-setcentercolor.md

File metadata and controls

148 lines (96 loc) · 5.47 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist req.product ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:gdipluspath.PathGradientBrush.SetCenterColor
PathGradientBrush::SetCenterColor (gdipluspath.h)
The PathGradientBrush::SetCenterColor method sets the center color of this path gradient brush. The center color is the color that appears at the brush's center point.
PathGradientBrush class [GDI+]
SetCenterColor method
PathGradientBrush.SetCenterColor
PathGradientBrush::SetCenterColor
SetCenterColor
SetCenterColor method [GDI+]
SetCenterColor method [GDI+]
PathGradientBrush class
_gdiplus_CLASS_PathGradientBrush_SetCenterColor_color_
gdiplus._gdiplus_CLASS_PathGradientBrush_SetCenterColor_color_
gdiplus\_gdiplus_CLASS_PathGradientBrush_SetCenterColor_color_.htm
gdiplus
VS|gdicpp|~\gdiplus\gdiplusreference\classes\pathgradientbrushclass\pathgradientbrushmethods\setcentercolor.htm
12/05/2018
PathGradientBrush class [GDI+],SetCenterColor method, PathGradientBrush.SetCenterColor, PathGradientBrush::SetCenterColor, SetCenterColor, SetCenterColor method [GDI+], SetCenterColor method [GDI+],PathGradientBrush class, _gdiplus_CLASS_PathGradientBrush_SetCenterColor_color_, gdiplus._gdiplus_CLASS_PathGradientBrush_SetCenterColor_color_
gdipluspath.h
Gdiplus.h
Windows
Windows XP, Windows 2000 Professional [desktop apps only]
Windows 2000 Server [desktop apps only]
Gdiplus.lib
Gdiplus.dll
Windows
GDI+ 1.0
19H1
PathGradientBrush::SetCenterColor
gdipluspath/PathGradientBrush::SetCenterColor
c++
APIRef
kbSyntax
COM
Gdiplus.dll
PathGradientBrush.SetCenterColor

PathGradientBrush::SetCenterColor

-description

The PathGradientBrush::SetCenterColor method sets the center color of this path gradient brush. The center color is the color that appears at the brush's center point.

-parameters

-param color [in, ref]

Type: const Color

Reference to a Color object that specifies the center color.

-returns

Type: Status

If the method succeeds, it returns Ok, which is an element of the Status enumeration.

If the method fails, it returns one of the other elements of the Status enumeration.

-remarks

By default the center point is the centroid of the brush's boundary path, but you can set the center point to any location inside or outside the path.

Examples

The following example creates a PathGradientBrush object based on an ellipse. The code calls the PathGradientBrush::SetCenterColor method of the PathGradientBrush object to set the center color to blue. The PathGradientBrush::SetSurroundColors method sets the color along the entire boundary to aqua. The FillRectangle Methods method uses the path gradient brush to paint a rectangle that contains the ellipse.

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

   // Create a path that consists of a single ellipse.
   GraphicsPath path;
   path.AddEllipse(0, 0, 200, 100);

   // Use the path to construct a brush.
   PathGradientBrush pthGrBrush(&path);

   // Set the color at the center of the path to blue.
   pthGrBrush.SetCenterColor(Color(255, 0, 0, 255));

   // Set the color along the entire boundary of the path to aqua.
   Color colors[] = {Color(255, 0, 255, 255)};
   INT count = 1;
   pthGrBrush.SetSurroundColors(colors, &count);

   graphics.FillRectangle(&pthGrBrush, 0, 0, 300, 300); 
}

-see-also

Brushes and Filled Shapes

Color

Creating a Path Gradient

Filling a Shape with a Color Gradient

GraphicsPath

PathGradientBrush

PathGradientBrush::GetCenterColor

PathGradientBrush::GetCenterPoint Methods

PathGradientBrush::SetCenterPoint Methods