Share via


GraphicsPathIterator::NextSubpath(constGraphicsPath*,BOOL*) メソッド (gdipluspath.h)

GraphicsPathIterator::NextSubpath メソッドは、この反復子の関連付けられたパスから次の図 (サブパス) を取得します。

構文

INT NextSubpath(
  [out] const GraphicsPath *path,
  [out] BOOL               *isClosed
);

パラメーター

[out] path

種類: GraphicsPath*

GraphicsPath オブジェクトへのポインター。 このメソッドは、取得した図形のデータ ポイントと一致するように、この GraphicsPath オブジェクトのデータ ポイントを設定します。

[out] isClosed

種類: BOOL*

取得した図形が閉じているかどうかを示す値を受け取る BOOL へのポインター。 図形が閉じている場合、受け取った値は TRUE です。それ以外の場合、受信した値は FALSE です

戻り値

型: INT

このメソッドは、取得した図のデータ ポイントの数を返します。 取得する図形がこれ以上ない場合、このメソッドは 0 を返します。

注釈

反復子の GraphicsPathIterator::NextSubpath メソッドを初めて呼び出すと、その反復子の関連付けられたパスの最初の図 (サブパス) が取得されます。 2 回目は、2 番目の図を取得します。などです。 GraphicsPathIterator::NextSubpath を呼び出すたびに、取得した図のデータ ポイントの数が返されます。 数値が残っていない場合は、0 を返します。

次の例では 、GraphicsPath オブジェクトを作成し、パスに 5 つの図形 (サブパスとも呼ばれます) を追加します。 このコードでは、 GraphicsPath オブジェクトのアドレスを GraphicsPathIterator コンストラクターに渡して、パスに関連付けられた反復子を作成します。 このコードでは、反復子の GraphicsPathIterator::NextSubpath メソッドを 2 回呼び出して、パスから 2 番目の図 (サブパス) を取得します。 次に、Graphics オブジェクトの DrawPath メソッドを呼び出して、その個々のサブパスを描画します。


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

   // Create a graphics path with five figures (subpaths).
   GraphicsPath path;

   path.AddRectangle(Rect(20, 20, 60, 30));   // Subpath count is 1.

   path.AddLine(100, 20, 160, 50);            // Subpath count is 2.
   path.AddArc(180, 20, 60, 30, 0.0f, 180.0f);

   path.AddRectangle(Rect(260, 20, 60, 30));  // Subpath count is 3.

   path.AddLine(340, 20, 400, 50);            // Subpath count is 4.
   path.AddArc(340, 20, 60, 30, 0.0f, 180.0f);
   path.CloseFigure();
  
   path.AddRectangle(Rect(420, 20, 60, 30));  // Subpath count is 5.
 
   // Create an iterator, and associate it with the path.
   GraphicsPathIterator iterator(&path);

   // Get the second subpath by calling NextSubpath twice.
   GraphicsPath subpath;
   BOOL isClosed;
   INT count;
   count = iterator.NextSubpath(&subpath, &isClosed);
   count = iterator.NextSubpath(&subpath, &isClosed);

   // The variable "count" now holds the number of 
   // data points in the second subpath.

   // Draw the retrieved subpath.
   Pen bluePen(Color(255, 0, 0, 255));
   graphics.DrawPath(&bluePen, &subpath);
}

要件

要件
サポートされている最小のクライアント Windows XP、Windows 2000 Professional [デスクトップ アプリのみ]
サポートされている最小のサーバー Windows 2000 Server [デスクトップ アプリのみ]
対象プラットフォーム Windows
ヘッダー gdipluspath.h (Gdiplus.h を含む)
Library Gdiplus.lib
[DLL] Gdiplus.dll

関連項目

パスの作成および描画

GetPathData

Graphicspath

GraphicsPathIterator

GraphicsPathIterator::GetSubpathCount

GraphicsPathIterator::NextMarker メソッド

NextSubpath

パス