GraphicsPath::GetPointCount 方法获取此路径的数据点数组中的点数。 这与路径的点类型数组中的类型数相同。
语法
INT GetPointCount();
返回值
类型: INT
此方法返回路径的数据点数组中的点数。
注解
GraphicsPath 对象具有一个点数组和一个类型的数组。 类型数组中的每个元素都是一个字节,用于指定点类型和点数组中对应元素的一组标志。 PathPointType 枚举中列出了可能的点类型和标志。
示例
以下示例创建一个具有一个椭圆和一行的路径。 代码调用 GraphicsPath::GetPointCount 方法来确定路径中存储的数据点数。 然后,代码调用 GraphicsPath::GetPathPoints 方法来检索这些数据点。 最后,代码在每个数据点填充一个小椭圆。
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)
      graphics.FillEllipse(
         &redBrush, 
         points[j].X - 3.0f, 
         points[j].Y - 3.0f, 
         6.0f, 
         6.0f); 
   delete [] points; 
} 
要求
| 最低受支持的客户端 | Windows XP、Windows 2000 Professional [仅限桌面应用] | 
| 最低受支持的服务器 | Windows 2000 Server [仅限桌面应用] | 
| 目标平台 | Windows | 
| 标头 | gdipluspath.h (包括 Gdiplus.h) | 
| Library | Gdiplus.lib | 
| DLL | Gdiplus.dll |