Método GraphicsPathIterator::Rewind (gdipluspath.h)

El método GraphicsPathIterator::Rewind rebobina este iterador al principio de su ruta de acceso asociada.

Sintaxis

void Rewind();

Valor devuelto

Ninguno

Observaciones

La primera vez que se llama al método NextSubpath de un iterador, obtiene la primera figura (subruta) de la ruta de acceso asociada del iterador. La segunda vez, obtiene la segunda figura, etc. Cuando se llama a GraphicsPathIterator::Rewind, la secuencia comienza; es decir, después de llamar a GraphicsPathIterator::Rewind, la siguiente llamada a GraphicsPathIterator::NextSubpath obtiene la primera figura de la ruta de acceso. Los métodos GraphicsPathIterator::NextMarker y GraphicsPathIterator::NextPathType se comportan de forma similar.

Ejemplos

En el ejemplo siguiente se crea un objeto GraphicsPath y se agregan cinco figuras a la ruta de acceso. El código pasa la dirección de ese objeto GraphicsPath a un constructor GraphicsPathIterator para crear un iterador asociado a la ruta de acceso. El código llama al método GraphicsPathIterator::NextSubpath del iterador dos veces para recuperar la segunda figura de la ruta de acceso. El método DrawPath dibuja esa ruta de acceso en azul. A continuación, el código llama al método GraphicsPathIterator::Rewind y, a continuación, llama a GraphicsPathIterator::NextSubpath una vez para obtener la primera figura de la ruta de acceso. El método DrawPath dibuja esa figura en rojo.


VOID RewindExample(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);

   // Draw the second figure in blue.
   Pen bluePen(Color(255, 0, 0, 255));
   graphics.DrawPath(&bluePen, &subpath);

   // Rewind the iterator, and get the first figure in the path.
   iterator.Rewind();
   count = iterator.NextSubpath(&subpath, &isClosed);

   // Draw the first figure in red.
   Pen redPen(Color(255, 255, 0, 0));
   graphics.DrawPath(&redPen, &subpath);
}

Requisitos

   
Cliente mínimo compatible Windows XP, Windows 2000 Professional [solo aplicaciones de escritorio]
Servidor mínimo compatible Windows 2000 Server [solo aplicaciones de escritorio]
Plataforma de destino Windows
Encabezado gdipluspath.h (incluya Gdiplus.h)
Library Gdiplus.lib
Archivo DLL Gdiplus.dll

Consulte también

Crear y dibujar trazados

Graphicspath

GraphicsPathIterator

GraphicsPathIterator::NextMarker (Métodos)

GraphicsPathIterator::NextPathType

GraphicsPathIterator::NextSubpath (Métodos)

Paths