Método PathGradientBrush::GetCenterPoint(PointF*) (gdipluspath.h)

O método PathGradientBrush::GetCenterPoint obtém o ponto central desse pincel de gradiente de caminho.

Sintaxe

Status GetCenterPoint(
  PointF *point
);

Parâmetros

point

Ponteiro para um objeto PointF que recebe o ponto central.

Valor retornado

Type:Status

Se o método for bem-sucedido, ele retornará Ok, que é um elemento da enumeração Status .

Se o método falhar, ele retornará um dos outros elementos da enumeração Status .

Comentários

Por padrão, o ponto central de um objeto PathGradientBrush está no centroide do caminho de limite do pincel, mas você pode definir o ponto central como qualquer local, dentro ou fora do caminho, chamando o método SetCenterPoint do objeto PathGradientBrush .

Exemplos

O exemplo a seguir demonstra vários métodos da classe PathGradientBrush , incluindo PathGradientBrush::GetCenterPoint e PathGradientBrush::SetCenterColor. O código cria um objeto PathGradientBrush e define a cor central e a cor do limite do pincel. O código chama o método PathGradientBrush::GetCenterPoint para determinar o ponto central do gradiente de caminho e, em seguida, desenha uma linha da origem para esse ponto central.

VOID Example_GetCenterPoint(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.
   PointF centerPoint;
   pthGrBrush.GetCenterPoint(&centerPoint);

   // Draw a line from the origin to the center of the ellipse.
   Pen pen(Color(255, 0, 255, 0));
   graphics.DrawLine(&pen, PointF(0, 0), centerPoint);  
}

Requisitos

   
Cabeçalho gdipluspath.h

Confira também

Pincéis e formas preenchidas

Cor

Criando um Gradiente de Caminho

Preenchendo uma forma com um Gradiente de Cor

Pathgradientbrush

PathGradientBrush::GetCenterColor

PathGradientBrush::SetCenterColor

Métodos PathGradientBrush::SetCenterPoint