LinearGradientBrush::SetWrapMode 方法 (gdiplusbrush.h)
LinearGradientBrush::SetWrapMode方法會設定這個線性漸層筆刷的換行模式。
語法
Status SetWrapMode(
[in] WrapMode wrapMode
);
參數
[in] wrapMode
類型: WrapMode
WrapMode列舉的 元素,指定如何使用這個線性漸層筆刷繪製的區域磚。 此參數的值必須是下列其中一個專案:
- WrapModeTile
- WrapModeTileFlipX
- WrapModeTileFlipY
- WrapModeTileFlipXY
傳回值
類型: 狀態
如果方法成功,它會傳回 Ok,這是 Status 列舉的元素。
如果方法失敗,它會傳回 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) |
程式庫 | Gdiplus.lib |
Dll | Gdiplus.dll |
另請參閱
LinearGradientBrush \(英文\)