PathGradientBrush::SetCenterColor-Methode (gdipluspath.h)

Die PathGradientBrush::SetCenterColor-Methode legt die Mittelfarbe dieses Pfadverlaufspinsels fest. Die mittlere Farbe ist die Farbe, die am Mittelpunkt des Pinsels angezeigt wird.

Syntax

Status SetCenterColor(
  [in, ref] const Color & color
);

Parameter

[in, ref] color

Typ: const Color

Verweis auf ein Color-Objekt , das die mittlere Farbe angibt.

Rückgabewert

Typ: Status

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

Wenn die Methode fehlschlägt, gibt sie eines der anderen Elemente der Status-Enumeration zurück.

Hinweise

Standardmäßig ist der Mittelpunkt der Mittelpunkt des Begrenzungspfads des Pinsels. Sie können den Mittelpunkt jedoch auf eine beliebige Position innerhalb oder außerhalb des Pfads festlegen.

Beispiele

Im folgenden Beispiel wird ein PathGradientBrush-Objekt basierend auf einer Ellipse erstellt. Der Code ruft die PathGradientBrush::SetCenterColor-Methode des PathGradientBrush-Objekts auf, um die mittlere Farbe auf Blau festzulegen. Die PathGradientBrush::SetSurroundColors-Methode legt die Farbe entlang der gesamten Grenze auf aqua fest. Die FillRectangle Methods-Methode verwendet den Pfadverlaufspinsel, um ein Rechteck zu zeichnen, das die Ellipse enthält.

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

   graphics.FillRectangle(&pthGrBrush, 0, 0, 300, 300); 
}

Anforderungen

Anforderung Wert
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

Graphicspath

Pathgradientbrush

PathGradientBrush::GetCenterColor

PathGradientBrush::GetCenterPoint-Methoden

PathGradientBrush::SetCenterPoint-Methoden