GraphicsPath::GetPointCount method

The GraphicsPath::GetPointCount method gets the number of points in this path's array of data points. This is the same as the number of types in the path's array of point types.


INT GetPointCount(



This method has no parameters.

Return Value

Type: Type: INT

This method returns the number of points in the path's array of data points.


A GraphicsPath object has an array of points and an array of types. Each element in the array of types is a byte that specifies the point type and a set of flags for the corresponding element in the array of points. Possible point types and flags are listed in the PathPointType enumeration.


The following example creates a path that has one ellipse and one line. The code calls the GraphicsPath::GetPointCount method to determine the number of data points stored in the path. Then the code calls the GraphicsPath::GetPathPoints method to retrieve those data points. Finally, the code fills a small ellipse at each of the data points.

VOID GetPointCountExample(HDC hdc)
   Graphics graphics(hdc);

   // Create a path that has one ellipse and one line.
   GraphicsPath path;
   path.AddEllipse(10, 10, 200, 100);
   path.AddLine(220, 120, 300, 160);

   // Find out how many data points are stored in the path.
   INT count = path.GetPointCount();

   // Draw the path points.
   SolidBrush redBrush(Color(255, 255, 0, 0));
   PointF* points = new PointF[count];
   path.GetPathPoints(points, count);

   for(INT j = 0; j < count; ++j)
         points[j].X - 3.0f, 
         points[j].Y - 3.0f, 

   delete [] points; 


Minimum supported client Windows XP, Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header gdipluspath.h (include Gdiplus.h)
Library Gdiplus.lib
DLL Gdiplus.dll

See Also

Clipping with a Region

Constructing and Drawing Paths

Creating a Path Gradient

GetPathPoints Methods