Share via


PathGradientBrush::GetCenterColor-Methode (gdipluspath.h)

Die PathGradientBrush::GetCenterColor-Methode ruft die Farbe des Mittelpunkts dieses Pfadverlaufspinsels ab.

Syntax

Status GetCenterColor(
  [out] Color *color
);

Parameter

[out] color

Typ: Farbe*

Zeiger auf ein Color-Objekt , das die Farbe des Mittelpunkts empfängt.

Rückgabewert

Typ: Status

Wenn die Methode erfolgreich ist, gibt sie OK zurück, ein Element der Status-Enumeration .

Wenn die Methode fehlschlägt, wird eines der anderen Elemente der Status-Enumeration zurückgegeben.

Hinweise

Standardmäßig ist der Mittelpunkt eines PathGradientBrush-Objekts der Schwerpunkt des Begrenzungspfads des Pinsels. Sie können den Mittelpunkt jedoch auf eine beliebige Position innerhalb oder außerhalb des Pfads festlegen, indem Sie die PathGradientBrush::SetCenterPoint-Methodenmethode des PathGradientBrush-Objekts aufrufen.

Beispiele

Im folgenden Beispiel wird ein PathGradientBrush-Objekt erstellt und zum Ausfüllen einer Ellipse verwendet. Anschließend ruft der Code die PathGradientBrush::GetCenterColor-Methode des PathGradientBrush-Objekts auf, um die mittlere Farbe zu erhalten.

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);
}

Anforderungen

   
Unterstützte Mindestversion (Client) Windows XP, Windows 2000 Professional [nur Desktop-Apps]
Unterstützte Mindestversion (Server) Windows 2000 Server [nur Desktop-Apps]
Zielplattform Windows
Kopfzeile gdipluspath.h (include Gdiplus.h)
Bibliothek Gdiplus.lib
DLL Gdiplus.dll

Weitere Informationen

Pinsel und gefüllte Formen

Farbe

Erstellen eines Pfadverlaufs

Füllen einer Form mit einem Farbverlauf

Pathgradientbrush

PathGradientBrush::GetCenterPoint-Methoden

PathGradientBrush::SetCenterColor

PathGradientBrush::SetCenterPoint-Methoden