PathGradientBrush::GetCenterColor, méthode (gdipluspath.h)
La méthode PathGradientBrush::GetCenterColor obtient la couleur du point central de ce pinceau de dégradé de chemin.
Syntaxe
Status GetCenterColor(
[out] Color *color
);
Paramètres
[out] color
Type : Couleur*
Pointeur vers un objet Color qui reçoit la couleur du point central.
Valeur retournée
Type : État
Si la méthode réussit, elle retourne Ok, qui est un élément de l’énumération Status .
Si la méthode échoue, elle retourne l’un des autres éléments de l’énumération Status .
Notes
Par défaut, le point central d’un objet PathGradientBrush est le centroïde du chemin de limite du pinceau, mais vous pouvez définir le point central sur n’importe quel emplacement, à l’intérieur ou à l’extérieur du chemin, en appelant la méthode PathGradientBrush::SetCenterPoint Methods de l’objet PathGradientBrush .
Exemples
L’exemple suivant crée un objet PathGradientBrush et l’utilise pour remplir une ellipse. Ensuite, le code appelle la méthode PathGradientBrush::GetCenterColor de l’objet PathGradientBrush pour obtenir la couleur centrale.
VOID Example_GetCenterColor(HDC hdc)
{
Graphics graphics(hdc);
// Create a path that consists of a single ellipse.
GraphicsPath path;
path.AddEllipse(0, 0, 200, 100);
// Use the path to construct a brush.
PathGradientBrush pthGrBrush(&path);
// Set the color at the center of the path to blue.
pthGrBrush.SetCenterColor(Color(255, 0, 0, 255));
// Set the color along the entire boundary of the path to aqua.
Color colors[] = {Color(255, 0, 255, 255)};
int count = 1;
pthGrBrush.SetSurroundColors(colors, &count);
// Fill the ellipse with the path gradient brush.
graphics.FillEllipse(&pthGrBrush, 0, 0, 200, 100);
// Obtain information about the path gradient brush.
Color color;
pthGrBrush.GetCenterColor(&color);
// Fill a rectangle with the retrieved color.
SolidBrush solidBrush(color);
graphics.FillRectangle(&solidBrush, 0, 120, 200, 30);
}
Configuration requise
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
Création d’un dégradé de chemin
Remplissage d’une forme avec un dégradé de couleur
PathGradientBrush::GetCenterPoint, méthodes
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