PathGradientBrush::SetCenterColor メソッド (gdipluspath.h)

PathGradientBrush::SetCenterColor メソッドは、このパス グラデーション ブラシの中心の色を設定します。 中心の色は、ブラシの中心点に表示される色です。

構文

Status SetCenterColor(
  [in, ref] const Color & color
);

パラメーター

[in, ref] color

型: const Color

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

戻り値

種類: 状態

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

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

注釈

既定では、中心点はブラシの境界パスの重心ですが、中心点はパスの内側または外側の任意の場所に設定できます。

次の例では、楕円に基づいて PathGradientBrush オブジェクトを作成します。 このコードは、PathGradientBrush オブジェクトの PathGradientBrush::SetCenterColor メソッドを呼び出して、中心の色を青に設定します。 PathGradientBrush::SetSurroundColors メソッドは、境界全体に沿った色を aqua に設定します。 FillRectangle メソッドは、パス グラデーション ブラシを使用して、楕円を含む四角形を描画します。

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 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); 
}

要件

要件
サポートされている最小のクライアント Windows XP、Windows 2000 Professional [デスクトップ アプリのみ]
サポートされている最小のサーバー Windows 2000 Server [デスクトップ アプリのみ]
対象プラットフォーム Windows
ヘッダー gdipluspath.h (Gdiplus.h を含む)
Library Gdiplus.lib
[DLL] Gdiplus.dll

こちらもご覧ください

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

Color

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

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

Graphicspath

PathGradientBrush

PathGradientBrush::GetCenterColor

PathGradientBrush::GetCenterPoint メソッド

PathGradientBrush::SetCenterPoint メソッド