描述
设置此线性渐变画笔的包模式.
C++ Syntax
Status SetWrapMode( [in] WrapMode wrapMode ); |
FreeBASIC 语法
FUNCTION SetWrapMode ( _ BYVAL wrapMode AS WrapMode _ ) AS GpStatus |
参数
wrapMode
该模式指定区域是如何画这个线性渐变画笔将平铺[in]元.此参数的值必须是下列元素之一:
· | WrapModeTile |
· | WrapModeTileFlipX |
· | WrapModeTileFlipY |
· | WrapModeTileFlipXY |
返回值
如果该方法成功,则返回Ok,这是对Status枚举元素.
如果这个方法失败,它返回一个枚举的其他元素的Status.
备注
线性梯度刷的边界线形成一个瓦片.当你画一个线性梯度刷面积,瓷砖重复.线性渐变画笔可以有交替瓦片翻转在一定的方向,如指定的包模式.翻转有反转颜色顺序的效果.
环绕模式默认为WrapModeTile当LinearGradientBrush对象构造.
引用文件
CGpBrush.inc (include CGdiPlus.inc)
示例
' ========================================================================================
' The following example creates a linear gradient brush and uses it to fill a rectangle.
' Next, the code modifies the brush's wrap mode and uses the modified brush to fill another
' rectangle.
' ========================================================================================
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)
' // Create a linear gradient brush.
DIM rc AS GpRect = GDIP_RECT(0, 0, 100, 50)
DIM linGrBrush AS CGpLinearGradientBrush = CGpLinearGradientBrush(@rc, _
GDIP_ARGB(255, 255, 0, 0), GDIP_ARGB(255, 0, 0, 255), LinearGradientModeHorizontal)
' // Fill a large area using the gradient brush with the default wrap mode.
graphics.FillRectangle(@linGrBrush, 0, 0, 800, 50)
linGrBrush.SetWrapMode(WrapModeTileFlipX)
' // Fill a large area using the gradient brush with the new wrap mode.
graphics.FillRectangle(@linGrBrush, 0, 75, 800, 50)
END SUB
' ========================================================================================