PathGradientBrush::GetWrapMode 方法 (gdipluspath.h)

PathGradientBrush::GetWrapMode方法會取得此路徑漸層筆刷目前設定的換行模式。

Syntax

WrapMode GetWrapMode();

傳回值

類型: WrapMode

這個方法會傳回 WrapMode 列舉的專案,指出目前為這個路徑漸層筆刷設定的換行模式。

備註

路徑漸層筆刷的周框是括住筆刷界限路徑的最小矩形。 當您使用路徑漸層筆刷繪製周框時,只會填滿界限路徑內的區域。 周框內的區域,但界限路徑外部不會填滿。

路徑漸層筆刷的預設換行模式是 WrapModeClamp,表示筆刷周框外不會發生任何繪製。 所有其他換行模式都表示筆刷周框外的區域將會並排顯示。 每個磚都是 (在其周框內填滿路徑) 可能翻轉的複本。

範例

下列範例會根據三角形路徑建立 PathGradientBrush 物件。 此程式碼會呼叫PathGradientBrush::PathGradientBrush 物件的 SetWrapMode方法,將包裝模式設定為WrapModeTileFlipX 接下來,程式碼會呼叫PathGradientBrush::PathGradientBrush 物件的 GetWrapMode方法,以取得筆刷的換行模式。 如果取得的換行模式是 WrapModeTileFlipX,程式碼會呼叫 FillRectangle ,以使用路徑漸層筆刷來磚大型區域。

VOID Example_GetWrapMode(HDC hdc)
{
   Graphics graphics(hdc);

   // Create a path gradient brush based on an array of points,
   // and set its wrap mode.
   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);

   // Obtain information about the path gradient brush.
   WrapMode wrapMode; 
   wrapMode = pthGrBrush.GetWrapMode();

   if(wrapMode == 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

另請參閱

筆刷和填滿的圖形

建立路徑漸層

以色彩漸層填滿圖形

PathGradientBrush

PathGradientBrush::SetWrapMode

使用影像將圖形貼上