PathGradientBrush::SetCenterPoint(constPointF&)-Methode (gdipluspath.h)
Die PathGradientBrush::SetCenterPoint-Methode legt den Mittelpunkt dieses Pfadverlaufspinsels fest. Standardmäßig befindet sich der Mittelpunkt am Mittelpunkt des Begrenzungspfads des Pinsels, Sie können den Mittelpunkt jedoch auf eine beliebige Position innerhalb oder außerhalb des Pfads festlegen.
Syntax
Status SetCenterPoint(
const PointF & point
);
Parameter
point
Verweis auf ein PointF-Objekt , das den Mittelpunkt 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, wird eines der anderen Elemente der Status-Enumeration zurückgegeben.
Bemerkungen
Beispiele
Im folgenden Beispiel wird ein PathGradientBrush-Objekt basierend auf einer Ellipse erstellt. Der Code legt die mittlere Farbe auf Blau und die Farbe entlang der Grenze auf Aqua fest. Standardmäßig befindet sich der Mittelpunkt in der Mitte der Ellipse (100, 50), aber der Aufruf der PathGradientBrush::SetCenterPoint-Methode legt den Mittelpunkt auf (180.5, 50.0).
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 center point.
pthGrBrush.SetCenterPoint(PointF(180.5f, 50.0f));
// 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 |
---|---|
Header | gdipluspath.h |
Weitere Informationen
Füllen einer Form mit einem Farbverlauf
PathGradientBrush::GetCenterColor
Feedback
https://aka.ms/ContentUserFeedback.
Bald verfügbar: Im Laufe des Jahres 2024 werden wir GitHub-Issues stufenweise als Feedbackmechanismus für Inhalte abbauen und durch ein neues Feedbacksystem ersetzen. Weitere Informationen finden Sie unterFeedback senden und anzeigen für