다음을 통해 공유


GraphicsPathIterator::GetCount 메서드(gdipluspath.h)

GraphicsPathIterator::GetCount 메서드는 경로의 데이터 요소 수를 반환합니다.

구문

INT GetCount();

반환 값

형식: INT

이 메서드는 경로의 데이터 포인트 수를 반환합니다.

설명

GraphicsPathIterator 개체는 GraphicsPath 개체와 연결됩니다. 해당 GraphicsPath 개체에는 점 배열과 형식의 배열이 있습니다. 형식 배열의 각 요소는 점 형식을 지정하는 바이트이며 점 배열의 해당 요소에 대한 플래그 집합입니다. 가능한 점 유형 및 플래그는 PathPointType 열거형에 나열됩니다.

예제

다음 예제에서는 GraphicsPath 개체를 만든 다음 사각형과 타원을 경로에 추가합니다. 코드는 해당 GraphicsPath 개체의 주소를 GraphicsPathIterator 생성자에 전달하여 경로와 연결된 반복기를 만듭니다. 이 코드는 반복기의 GraphicsPathIterator::GetCount 메서드를 호출하여 경로의 데이터 요소 수를 확인합니다. GraphicsPathIterator::Enumerate 호출은 경로에서 두 개의 배열을 검색합니다. 하나는 경로의 데이터 요소를 보유하고 다른 하나는 경로의 점 형식을 보유합니다. 데이터 요소를 검색한 후 코드는 개체의 FillEllipse 메서드를 호출하여 각 데이터 요소를 그립니다.


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

   // Create a path that has a rectangle and an ellipse.
   GraphicsPath path;
   path.AddRectangle(Rect(20, 20, 60, 30));
   path.AddEllipse(Rect(20, 70, 100, 50));

   // Create an iterator, and associate it with the path.
   GraphicsPathIterator iterator(&path);

   // Get the number of data points in the path.
   INT count = iterator.GetCount();

   // Get the data points.
   PointF* points = new PointF[count];
   BYTE* types = new BYTE[count];
   iterator.Enumerate(points, types, count);

   // Draw the data points.
   SolidBrush brush(Color(255, 255, 0, 0));
   for(INT j = 0; j < count; ++j)
      graphics.FillEllipse(
         &brush,
         points[j].X - 3.0f, 
         points[j].Y - 3.0f,
         6.0f,
         6.0f);

   delete points;
   delete types;
}

요구 사항

요구 사항
지원되는 최소 클라이언트 Windows XP, Windows 2000 Professional [데스크톱 앱만 해당]
지원되는 최소 서버 Windows 2000 Server[데스크톱 앱만]
대상 플랫폼 Windows
헤더 gdipluspath.h(Gdiplus.h 포함)
라이브러리 Gdiplus.lib
DLL Gdiplus.dll

참고 항목

경로 구성 및 그리기

GetPathData

GetPathPoints 메서드

GetPathTypes

GetPointCount

Graphicspath

GraphicsPathIterator

GraphicsPathIterator::CopyData

GraphicsPathIterator::Enumerate

경로