Share via


GraphicsPathIterator::NextMarker(constGraphicsPath*) , méthode (gdipluspath.h)

La méthode GraphicsPathIterator::NextMarker obtient la section délimitée par les marqueurs suivante du chemin d’accès associé de cet itérateur.

Syntaxe

INT NextMarker(
  [out] const GraphicsPath *path
);

Paramètres

[out] path

Type : GraphicsPath*

Pointeur vers un objet GraphicsPath . Cette méthode définit les points de données de cet objet GraphicsPath pour qu’ils correspondent aux points de données de la section récupérée.

Valeur retournée

Type : INT

Cette méthode retourne le nombre de points de données dans la section récupérée. S’il n’y a plus de sections délimitées par des marqueurs à récupérer, cette méthode retourne 0.

Notes

Un chemin d’accès a un tableau de points de données qui définissent ses lignes et ses courbes. Vous pouvez appeler la méthode SetMarker d’un chemin d’accès pour désigner certains points du tableau en tant que marqueurs. Ces points de marqueur divisent le chemin en sections.

La première fois que vous appelez la méthode GraphicsPathIterator::NextMarker d’un itérateur, il obtient la première section délimitée par des marqueurs du chemin d’accès associé de cet itérateur. La deuxième fois, il obtient la deuxième section, et ainsi de suite. Chaque fois que vous appelez GraphicsPathIterator::NextSubpath, il retourne le nombre de points de données dans la section récupérée. Lorsqu’il n’y a aucune section restante, elle retourne 0.

Exemples

L’exemple suivant crée un objet GraphicsPath et ajoute cinq figures au chemin d’accès. Les appels à la méthode SetMarker placent deux marqueurs dans le chemin. Le premier marqueur se trouve à la fin d’une figure et le deuxième marqueur se trouve au milieu d’une figure. Le code transmet l’adresse de l’objet GraphicsPath à un constructeur GraphicsPathIterator pour créer un itérateur associé au chemin d’accès. Ensuite, le code appelle deux fois la méthode GraphicsPathIterator::NextMarker de l’itérateur pour obtenir la deuxième section délimitée par les marqueurs du chemin d’accès. Enfin, le code dessine la section récupérée du chemin d’accès.


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

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

   path.AddRectangle(Rect(20, 20, 60, 30));
   path.SetMarker();                          // first marker

   path.AddLine(100, 20, 160, 50);
   path.AddArc(180, 20, 60, 30, 0.0f, 180.0f);

   path.AddRectangle(Rect(260, 20, 60, 30));

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

   // Get the second marker-delimited section by calling NextMarker twice.
   GraphicsPath section;
   INT count;
   count = iterator.NextMarker(&section);
   count = iterator.NextMarker(&section);

   // The variable "count" now holds the number of 
   // data points in the second marker-delimited section.

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

Spécifications

   
Client minimal pris en charge Windows XP, Windows 2000 Professionnel [applications de bureau uniquement]
Serveur minimal pris en charge Windows 2000 Server [applications de bureau uniquement]
Plateforme cible Windows
En-tête gdipluspath.h (inclure Gdiplus.h)
Bibliothèque Gdiplus.lib
DLL Gdiplus.dll

Voir aussi

Génération et dessin de tracés

GetPathData

Graphicspath

GraphicsPathIterator

GraphicsPathIterator::NextSubpath, méthodes

NextMarker

Chemins d’accès