PathGradientBrush::SetBlendTriangularShape-Methode (gdipluspath.h)

Die PathGradientBrush::SetBlendTriangularShape-Methode legt die Mischform dieses Pfadverlaufspinsels fest.

Syntax

Status SetBlendTriangularShape(
  [in]           REAL focus,
  [in, optional] REAL scale
);

Parameter

[in] focus

Typ: REAL

Reelle Zahl, die angibt, wo die Mittlere Farbe die höchste Intensität aufweist. Diese Zahl muss im Bereich von 0 bis 1 liegen.

[in, optional] scale

Typ: REAL

Optional. Reelle Zahl, die die maximale Intensität der zentrierten Farbe angibt, die mit der Begrenzungsfarbe gemischt wird. Diese Zahl muss im Bereich von 0 bis 1 liegen. Der Standardwert ist 1.

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

Wenn Sie von der Grenze eines Pfadfarbverlaufs zum Mittelpunkt wechseln, ändert sich die Farbe standardmäßig allmählich von der Begrenzungsfarbe zur Mittleren Farbe. Sie können die Positionierung und Mischung der Begrenzungs- und Zentrierungsfarben anpassen, indem Sie die PathGradientBrush::SetBlendTriangularShape-Methode aufrufen.

Beispiele

Im folgenden Beispiel wird ein PathGradientBrush-Objekt basierend auf einer Ellipse erstellt. Der Code ruft die PathGradientBrush::SetBlendTriangularShape-Methode des PathGradientBrush-Objekts auf und übergibt einen Fokus von 0,2 und eine Skalierung von 0,7. Anschließend verwendet der Code den Pfadfarbverlaufpinsel, um ein Rechteck zu zeichnen, das die Ellipse enthält.

VOID Example_SetBlendShape(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 red.
   pthGrBrush.SetCenterColor(Color(255, 255, 0, 0));

   // Set the color along the entire boundary of the path to blue.
   Color colors[] = {Color(255, 0, 0, 255)};
   INT count = 1;
   pthGrBrush.SetSurroundColors(colors, &count);

   pthGrBrush.SetBlendTriangularShape(0.2f, 0.7f);

   // The color is blue on the boundary and at the center.
   // At points that are 20 percent of the way from the boundary to the
   // center, the color is 70 percent red and 30 percent blue.

   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::GetBlend

PathGradientBrush::GetBlendCount

PathGradientBrush::SetBlend

PathGradientBrush::SetBlendBellShape