导航:  GdiPlus Classes > GdiPlus Classes > CGpBrush Class > CGpPathGradientBrush Class > PathGradientBrush Object >

SetWrapMode

上一页返回章节概述下一页

描述

 

设置此路径渐变刷的包模式.

 

C++ Syntax

 

Status SetWrapMode(

[in]  WrapMode wrapMode

);

 

FreeBASIC 语法

 

FUNCTION SetWrapMode ( _

  BYVAL nWrapMode AS WrapMode _

) AS GpStatus

 

参数

 

wrapMode

 

WrapMode枚举指定如何区画用路径渐变画笔将平铺[in]元.默认值是WrapModeClamp.

 

返回值

 

如果该方法成功,则返回Ok,这是对Status枚举元素.

如果这个方法失败,它返回一个枚举的其他元素的Status.

 

备注

 

路径渐变刷的边界矩形是包围画笔边界路径的最小矩形.使用路径渐变画笔绘制边界矩形时,只有边界路径中的区域被填充.边界矩形内的区域,但在边界路径外不填充.

WrapModeClamp(默认换行模式)表示没有画出现的矩形外刷.所有其他包模式表明,刷边界矩形外的区域将平铺.每个瓦片是一个拷贝(可能翻转)的填充路径内的边界矩形.

 

引用文件

 

CGpBrush.inc (include CGdiPlus.inc)

 

示例

 

' ========================================================================================

' The following example creates a PathGradientBrush object based on a triangular path. The

' code calls the PathGradientBrush::SetWrapMode method of the PathGradientBrush object to

' set the brush's wrap mode to WrapModeTileFlipX. The Graphics::FillRectangle method uses

' the path gradient brush to tile a large area.

' The output of the code is a grid of tiles. As you move from one tile to the next in a

' given row, the image (filled boundary path inside the bounding rectangle) is flipped

' horizontally.

' ========================================================================================

SUB Example_SetWrapMode (BYVAL hdc AS HDC)

 

  ' // Create a graphics object from the window device context

  DIM graphics AS CGpGraphics = hdc

  ' // Get the DPI scaling ratio

  DIM rxRatio AS SINGLE = graphics.GetDpiX / 96

  DIM ryRatio AS SINGLE = graphics.GetDpiY / 96

  ' // Set the scale transform

  graphics.ScaleTransform(rxRatio, ryRatio)

 

  DIM points(0 TO 2) AS GpPoint = {GDIP_POINT(0, 0), GDIP_POINT(100, 0), GDIP_POINT(100, 100)}

  DIM colors(0 TO 2) AS ARGB = {GDIP_ARGB(255, 255, 0, 0), GDIP_ARGB(255, 0, 0, 255), GDIP_ARGB(255, 0, 255, 0)}

 

  DIM nCount AS LONG = 3

  DIM pthGrBrush AS CGpPathGradientBrush = CGpPathGradientBrush(@points(0), 3)

  pthGrBrush.SetSurroundColors(@colors(0), @nCount)

  pthGrBrush.SetWrapMode(WrapModeTileFlipX)

 

  graphics.FillRectangle(@pthGrBrush, 0, 0, 800, 800)

 

END SUB

' ========================================================================================