GraphicsPathIterator ::NextSubpath(constGraphicsPath*,BOOL*) , méthode (gdipluspath.h)
La méthode GraphicsPathIterator ::NextSubpath obtient la figure suivante (sous-chemin) à partir du chemin associé de cet itérateur.
Syntaxe
INT NextSubpath(
[out] const GraphicsPath *path,
[out] BOOL *isClosed
);
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 figure récupérée.
[out] isClosed
Type : BOOL*
Pointeur vers un boOL qui reçoit une valeur qui indique si la figure récupérée est fermée. Si la figure est fermée, la valeur reçue est TRUE ; sinon, la valeur reçue est FALSE.
Valeur retournée
Type : INT
Cette méthode retourne le nombre de points de données dans la figure récupérée. S’il n’y a plus de chiffres à récupérer, cette méthode retourne 0.
Remarques
La première fois que vous appelez la méthode GraphicsPathIterator ::NextSubpath d’un itérateur, elle obtient la première figure (sous-chemin) du chemin associé de cet itérateur. La deuxième fois, il obtient le deuxième chiffre, et ainsi de suite. Chaque fois que vous appelez GraphicsPathIterator ::NextSubpath, il retourne le nombre de points de données dans la figure récupérée. Lorsqu’il n’y a pas de chiffres restants, il retourne 0.
Exemples
L’exemple suivant crée un objet GraphicsPath et ajoute cinq figures (également appelées sous-chemins) au chemin. Le code passe l’adresse de l’objet GraphicsPath à un constructeur GraphicsPathIterator pour créer un itérateur associé au chemin. Le code appelle la méthode GraphicsPathIterator ::NextSubpath de l’itérateur deux fois pour récupérer la deuxième figure (sous-chemin) à partir du chemin. Ensuite, le code appelle la méthode DrawPath d’un objet Graphics pour dessiner ce sous-chemin individuel.
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);
}
Configuration requise
Condition requise | Valeur |
---|---|
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 (include Gdiplus.h) |
Bibliothèque | Gdiplus.lib |
DLL | Gdiplus.dll |
Voir aussi
Génération et dessin de tracés
GraphicsPathIterator ::GetSubpathCount
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour