PathGradientBrush::SetWrapMode 方法 (gdipluspath.h)
PathGradientBrush::SetWrapMode 方法會設定此路徑漸層筆刷的包裝模式。
語法
Status SetWrapMode(
[in] WrapMode wrapMode
);
參數
[in] wrapMode
類型: WrapMode
WrapMode 列舉的 元素,指定如何使用路徑漸層筆刷繪製的區域會並排顯示。 預設值為 WrapModeClamp。
傳回值
類型: 狀態
如果方法成功,它會傳回 Ok,這是 Status 列舉的元素。
如果方法失敗,它會傳回 Status 列舉的其他其中一個專案。
備註
路徑漸層筆刷的周框是括住筆刷界限路徑的最小矩形。 當您使用路徑漸層筆刷繪製周框時,只會填滿界限路徑內的區域。 周框內但界限路徑外的區域不會填滿。
WrapModeClamp (預設換行模式) 表示筆刷周框外不會發生任何繪製。 所有其他包裝模式都表示筆刷周框外的區域將會並排顯示。 每個磚都是複製 (在其周框內可能翻轉的填滿路徑) 。
範例
下列範例會根據三角形路徑建立 PathGradientBrush 物件。 程序代碼會呼叫 PathGradientBrush::SetWrapMode物件的 PathGradientBrush 方法,將筆刷的包裝模式設定為 WrapModeTileFlipX。 Graphics::FillRectangle 方法會使用路徑漸層筆刷來並排大型區域。
程式代碼的輸出是圖格的方格。 當您從指定數據列中的一個磚移到下一個磚時,影像 (周框內的填滿界限路徑,) 水準翻轉。
VOID Example_SetWrapMode(HDC hdc)
{
Graphics graphics(hdc);
Point points[] = {
Point(0, 0),
Point(100, 0),
Point(100, 100)};
Color colors[] = {
Color(255, 255, 0, 0), // red
Color(255, 0, 0, 255), // blue
Color(255, 0, 255, 0)}; // green
INT count = 3;
PathGradientBrush pthGrBrush(points, 3);
pthGrBrush.SetSurroundColors(colors, &count);
pthGrBrush.SetWrapMode(WrapModeTileFlipX);
graphics.FillRectangle(&pthGrBrush, 0, 0, 800, 800);
}
規格需求
需求 | 值 |
---|---|
最低支援的用戶端 | Windows XP、Windows 2000 Professional [僅限桌面應用程式] |
最低支援的伺服器 | Windows 2000 Server [僅限桌面應用程式] |
目標平台 | Windows |
標頭 | gdipluspath.h (包含 Gdiplus.h) |
程式庫 | Gdiplus.lib |
Dll | Gdiplus.dll |