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

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

Syntax

Status GetCenterPoint(
  PointF *point
);

Parameter

point

Zeiger auf ein PointF-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 Pfadverlaufs 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.
   PointF 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, PointF(0, 0), centerPoint);  
}

Requirements (Anforderungen)

   
Kopfzeile gdipluspath.h

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