Share via


LinearGradientBrush::SetWrapMode メソッド (gdiplusbrush.h)

LinearGradientBrush::SetWrapMode メソッドは、この線形グラデーション ブラシのラップ モードを設定します。

構文

Status SetWrapMode(
  [in] WrapMode wrapMode
);

パラメーター

[in] wrapMode

型: WrapMode

この線形グラデーション ブラシで塗りつぶされた領域を並べて表示する方法を指定する WrapMode 列挙体の要素。 このパラメーターの値は、次のいずれかの要素である必要があります。

  • WrapModeTile
  • WrapModeTileFlipX
  • WrapModeTileFlipY
  • WrapModeTileFlipXY

戻り値

種類: 状態

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

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

解説

線形グラデーション ブラシの境界線がタイルを形成します。 線形グラデーション ブラシを使用して領域を塗りつぶすと、タイルが繰り返されます。 線形グラデーション ブラシでは、折り返しモードで指定されているように、代替タイルが特定の方向に反転される場合があります。 反転は、色の順序を反転させる効果があります。

LinearGradientBrush オブジェクトが構築されると、ラップ モードは既定で WrapModeTile になります。

次の例では、線形グラデーション ブラシを作成し、それを使用して四角形を塗りつぶします。 次に、コードはブラシのラップ モードを変更し、変更されたブラシを使用して別の四角形を塗りつぶします。

VOID Example_SetWrapMode(HDC hdc)
{
   Graphics myGraphics(hdc);

   LinearGradientBrush linGrBrush( 
      Rect(0, 0, 100, 50),
      Color(255, 255, 0, 0),  // red
      Color(255, 0, 0, 255),  // blue
      LinearGradientModeHorizontal);

   // Fill a large area using the gradient brush with the default wrap mode.
   myGraphics.FillRectangle(&linGrBrush, 0, 0, 800, 50);

   linGrBrush.SetWrapMode(WrapModeTileFlipX);

   // Fill a large area using the gradient brush with the new wrap mode.
   myGraphics.FillRectangle(&linGrBrush, 0, 75, 800, 50);
}

要件

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

関連項目

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

線形グラデーションの作成

LinearGradientBrush

LinearGradientBrush::GetWrapMode

Rect

画像を含む図形の並べ表示

Wrapmode