PathGradientBrush::SetCenterPoint(constPointF&) メソッド (gdipluspath.h)

PathGradientBrush::SetCenterPoint メソッドは、このパス グラデーション ブラシの中心点を設定します。 既定では、中心点はブラシの境界パスの重心にありますが、中心点はパスの内側または外側の任意の場所に設定できます。

構文

Status SetCenterPoint(
  const PointF & point
);

パラメーター

point

中心点を指定する PointF オブジェクトへの参照。

戻り値

Type:Status

メソッドが成功した場合は、 Status 列挙体の要素である Ok を返します。

メソッドが失敗した場合は、 Status 列挙体の他の要素のいずれかを返します。

解説

次の例では、楕円に基づいて PathGradientBrush オブジェクトを作成します。 このコードでは、中心の色を青に設定し、境界に沿った色を aqua に設定します。 既定では、中心点は楕円の中心 (100、50) になりますが、 PathGradientBrush::SetCenterPoint メソッドを呼び出すと、中心点は (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);
}

要件

要件
Header gdipluspath.h

こちらもご覧ください

ブラシと図形の塗りつぶし

パス グラデーションの作成

色のグラデーションで図形を塗りつぶす

Graphicspath

PathGradientBrush

PathGradientBrush::GetCenterColor

PathGradientBrush::GetCenterPoint メソッド

PathGradientBrush::SetCenterColor