PathGradientBrush ::GetCenterPoint(Point*), méthode (gdipluspath.h)

La méthode PathGradientBrush ::GetCenterPoint obtient le point central de ce pinceau de dégradé de chemin.

Syntaxe

Status GetCenterPoint(
  [out] Point *point
);

Paramètres

[out] point

Type : Point*

Pointeur vers un objet Point qui reçoit le point central.

Valeur retournée

Type : État

Si la méthode réussit, elle retourne Ok, qui est un élément de l’énumération Status .

Si la méthode échoue, elle retourne l’un des autres éléments de l’énumération Status .

Remarques

Par défaut, le point central d’un objet PathGradientBrush se trouve au centroïde du chemin de limite du pinceau, mais vous pouvez définir le point central à n’importe quel emplacement, à l’intérieur ou à l’extérieur du chemin, en appelant la méthode SetCenterPoint de l’objet PathGradientBrush .

Exemples

L’exemple suivant illustre plusieurs méthodes de la classe PathGradientBrush , notamment PathGradientBrush ::GetCenterPoint et PathGradientBrush ::SetCenterColor. Le code crée un objet PathGradientBrush , puis définit la couleur centrale et la couleur de limite du pinceau. Le code appelle la méthode PathGradientBrush ::GetCenterPoint pour déterminer le point central du pinceau de dégradé de chemin d’accès, puis dessine une ligne de l’origine vers ce point 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.
   Point  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, Point(0, 0), centerPoint);
}

Configuration requise

Condition requise Valeur
Client minimal pris en charge Windows XP, Windows 2000 Professionnel [applications de bureau uniquement]
Serveur minimal pris en charge Windows 2000 Server [applications de bureau uniquement]
Plateforme cible Windows
En-tête gdipluspath.h (include Gdiplus.h)
Bibliothèque Gdiplus.lib
DLL Gdiplus.dll

Voir aussi

Pinceaux et formes remplies

Color

Création d’un dégradé de chemin

Remplissage d’une forme avec un dégradé de couleur

PathGradientBrush

PathGradientBrush ::GetCenterColor

PathGradientBrush ::SetCenterColor

PathGradientBrush ::SetCenterPoint, méthodes