Метод PathGradientBrush::GetCenterColor (gdipluspath.h)

Метод PathGradientBrush::GetCenterColor получает цвет центральной точки этой кисти градиента пути.

Синтаксис

Status GetCenterColor(
  [out] Color *color
);

Параметры

[out] color

Тип: Цвет*

Указатель на объект Color , который получает цвет центральной точки.

Возвращаемое значение

Тип: Состояние

В случае успешного выполнения метода возвращается ОК, который является элементом перечисления Status .

Если метод завершается ошибкой, он возвращает один из других элементов перечисления Status .

Комментарии

По умолчанию центральной точкой объекта PathGradientBrush является центроид пути границы кисти, но центральную точку можно задать в любом расположении внутри или за его пределами, вызвав метод PathGradientBrush::SetCenterPoint Methods объекта PathGradientBrush .

Примеры

В следующем примере создается объект PathGradientBrush и он используется для заполнения многоточия. Затем код вызывает метод PathGradientBrush::GetCenterColor объекта PathGradientBrush , чтобы получить центральный цвет.

VOID Example_GetCenterColor(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);

   // Fill the ellipse with the path gradient brush.
   graphics.FillEllipse(&pthGrBrush, 0, 0, 200, 100);

   // Obtain information about the path gradient brush.
   Color color;
   pthGrBrush.GetCenterColor(&color);

   // Fill a rectangle with the retrieved color.
   SolidBrush solidBrush(color);
   graphics.FillRectangle(&solidBrush, 0, 120, 200, 30);
}

Требования

   
Минимальная версия клиента Windows XP, Windows 2000 Профессиональная [только классические приложения]
Минимальная версия сервера Windows 2000 Server [только классические приложения]
Целевая платформа Windows
Header gdipluspath.h (включая Gdiplus.h)
Библиотека Gdiplus.lib
DLL Gdiplus.dll

См. также раздел

Кисти и закрашенные фигуры

Цвет

Создание градиента пути

Заполнение фигуры цветным градиентом

PathGradientBrush

Методы PathGradientBrush::GetCenterPoint

PathGradientBrush::SetCenterColor

Методы PathGradientBrush::SetCenterPoint