PathGradientBrush::GetCenterPoint(Point*)-Methode (gdipluspath.h)

Die PathGradientBrush::GetCenterPoint-Methode ruft den Mittelpunkt dieses Pfadverlaufspinsels ab.

Syntax

Status GetCenterPoint(
  [out] Point *point
);

Parameter

[out] point

Typ: Punkt*

Zeiger auf ein Point-Objekt , das den Mittelpunkt 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 befindet sich der Mittelpunkt eines PathGradientBrush-Objekts am 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 SetCenterPoint-Methode des PathGradientBrush-Objekts aufrufen.

Beispiele

Im folgenden Beispiel werden mehrere Methoden der PathGradientBrush-Klasse veranschaulicht, einschließlich PathGradientBrush::GetCenterPoint und PathGradientBrush::SetCenterColor. Der Code erstellt ein PathGradientBrush-Objekt und legt dann die Mittel- und Begrenzungsfarbe des Pinsels fest. Der Code ruft die PathGradientBrush::GetCenterPoint-Methode auf, um den Mittelpunkt des Pfadverlaufspinsels zu bestimmen, und zeichnet dann eine Linie vom Ursprung zu diesem Mittelpunkt.

VOID Example_GetCenterPoint(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.
   Point  centerPoint;
   pthGrBrush.GetCenterPoint(&centerPoint);

   // Draw a line from the origin to the center of the ellipse.
   Pen pen(Color(255, 0, 255, 0));
   graphics.DrawLine(&pen, Point(0, 0), centerPoint);
}

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

Pathgradientbrush

PathGradientBrush::GetCenterColor

PathGradientBrush::SetCenterColor

PathGradientBrush::SetCenterPoint-Methoden