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

GetWrapMode

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

描述

 

获取当前为该纹理画笔设置的包装模式.

 

C++ Syntax

 

WrapMode GetWrapMode() const;

 

FreeBASIC 语法

 

FUNCTION GetWrapMode () AS WrapMode

 

参数

 

该方法没有参数.

 

返回值

 

此方法返回当前为该纹理画笔设置的包装模式.返回值是一个枚举元素的WrapMode.

 

引用文件

 

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. Next, the code gets the wrap mode of the brush and stores

' the value. The code creates a second texture brush and uses the stored wrap mode to set

' the wrap mode of the second texture brush. Then, the code uses the second texture brush

' to fill a rectangle.

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

SUB Example_WrapMode (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, 200, 200)

 

  ' // Get the brush's wrap mode.

  DIM nWrapMode AS WrapMode = textureBrush.GetWrapMode

 

  ' // Create a second texture brush with the same wrap mode.

  DIM pImage2 AS CGpImage = "MyTexture.png"

  DIM textureBrush2 AS CGpTextureBrush = @pImage2

  textureBrush2.SetWrapMode(nWrapMode)

  graphics.FillRectangle(@textureBrush2, 210, 0, 200, 200)

 

END SUB

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