Share via


Graphics::D rawPolygon(constPen*,constPointF*,INT) method (gdiplusgraphics.h)

La méthode Graphics::D rawPolygon dessine un polygone.

Syntaxe

Status DrawPolygon(
  const Pen    *pen,
  const PointF *points,
  INT          count
);

Paramètres

pen

Pointeur vers un stylet utilisé pour dessiner le polygone.

points

Pointeur vers un tableau d’objets PointF qui spécifient les sommets du polygone.

count

Entier qui spécifie le nombre d’éléments dans le tableau de points .

Valeur retournée

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 .

Notes

Si la première et la dernière coordonnées du tableau de points ne sont pas identiques, une ligne est dessinée entre elles pour fermer le polygone.

Exemples

L’exemple suivant dessine un polygone, défini par un tableau de points.

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

   // Create a Pen object.
   Pen blackPen(Color(255, 0, 0, 0), 3);

   // Create an array of PointF objects that define the polygon.
   PointF point1(100.0f, 100.0f);
   PointF point2(200.0f, 130.0f);
   PointF point3(150.0f, 200.0f);
   PointF point4(50.0f, 200.0f);
   PointF point5(0.0f, 130.0f);
   PointF points[5] = {point1, point2, point3, point4, point5};
   PointF* pPoints = points;

   // Draw the polygon.
   graphics.DrawPolygon(&blackPen, pPoints, 5);
}

Configuration requise

   
En-tête gdiplusgraphics.h

Voir aussi

FillPolygon, méthodes

Graphismes

Pointf

Polygones