GraphicsPathIterator::GetCount メソッド (gdipluspath.h)

GraphicsPathIterator::GetCount メソッドは、パス内のデータ ポイントの数を返します。

構文

INT GetCount();

戻り値

型: INT

このメソッドは、パス内のデータ ポイントの数を返します。

注釈

この GraphicsPathIterator オブジェクトは GraphicsPath オブジェクトに関連付けられています。 その GraphicsPath オブジェクトには、ポイントの配列と型の配列があります。 型の配列内の各要素は、ポイント型と、ポイントの配列内の対応する要素のフラグのセットを指定するバイトです。 使用可能なポイントの種類とフラグは、 PathPointType 列挙に一覧表示されます。

次の例では 、GraphicsPath オブジェクトを作成し、パスに四角形と省略記号を追加します。 このコードは、 その GraphicsPath オブジェクトのアドレスを GraphicsPathIterator コンストラクターに渡して、パスに関連付けられた反復子を作成します。 このコードでは、反復子の GraphicsPathIterator::GetCount メソッドを呼び出して、パス内のデータ ポイントの数を決定します。 GraphicsPathIterator::Enumerate の呼び出しは、パスから 2 つの配列を取得します。1 つはパスのデータ ポイントを保持し、もう 1 つはパスのポイント型を保持します。 データ ポイントが取得されると、コードはオブジェクトの 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 を含む)
Library Gdiplus.lib
[DLL] Gdiplus.dll

関連項目

パスの作成および描画

GetPathData

GetPathPoints メソッド

GetPathTypes

GetPointCount

Graphicspath

GraphicsPathIterator

GraphicsPathIterator::CopyData

GraphicsPathIterator::Enumerate

パス