导航:  GdiPlus Classes > GdiPlus Classes > CGpBrush Class > CGpTextureBrush Class > TextureBrush Object >

SetWrapMode

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

描述

 

设置纹理笔刷的包装模式.

 

C++ Syntax

 

Status SetWrapMode(

[in]  WrapMode wrapMode

);

 

FreeBASIC 语法

 

FUNCTION SetWrapMode ( _

   BYVAL nWrapMode AS WrapMode _

) AS GpStatus

 

参数

 

wrapMode

 

[in]元的WrapMode枚举指定如何重复拷贝的图像是用于瓷砖面积时,涂上这个纹理刷.

 

返回值

 

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

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

 

备注

 

超出画笔边界的区域用刷子的重复副本平铺.纹理刷可能有交替瓷砖翻转在一定的方向,如指定的包模式.翻转有反转画笔图像的效果.例如,如果覆盖模式被指定为WrapModeTileFlipX,刷翻转一线是平行于Y轴.

纹理画笔总是面向(0, 0).如果覆盖模式被指定为WrapModeClamp,刷的面积平铺外没有.例如,假设你创建纹理画笔,指定WrapModeClamp作为包装模式:

TextureBrush(SomeImage, WrapModeClamp)

然后用画笔画一个区域.如果画笔的大小高度50和绘制的区域是一个矩形,在(0, 50),其左上角你会看到没有重复的副本刷(不平铺).

对于纹理画笔的默认换行模式WrapModeTile,指定没有翻转瓦、不卡.

 

引用文件

 

CGpBrush.inc (include CGdiPlus.inc)

 

示例

 

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

' The following example creates a texture brush, sets the wrap mode of the brush, and uses

' the brush to fill a 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 texture brush, and set its transformation.

  DIM pImage AS CGpImage = "HouseAndTree.gif"

  DIM textureBrush AS CGpTextureBrush = @pImage

  textureBrush.SetWrapMode(WrapModeTileFlipX)

  graphics.FillRectangle(@textureBrush, 0, 0, 400, 200)

 

END SUB

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