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

ResetTransform

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

描述

 

将此路径渐变刷的变换矩阵重置为同一矩阵.这意味着没有转变将发生.

 

C++ Syntax

 

Status ResetTransform();

 

FreeBASIC 语法

 

FUNCTION ResetTransform () AS GpStatus

 

参数

 

该方法没有参数.

 

返回值

 

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

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

 

引用文件

 

CGpBrush.inc (include CGdiPlus.inc)

 

示例

 

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

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

' code calls the PathGradientBrush.ScaleTransform method of the PathGradientBrush object

' to fill the brush's transformation matrix with the elements that represent a horizontal

' scaling by a factor of 3. Then the code calls the PathGradientBrush.MultiplyTransform

' method of that same PathGradientBrush object to multiply the brush's existing transformation

' matrix by a matrix that represents a translation (10 right, 30 down). The MatrixOrderAppend

' argument indicates that the multiplication is performed with the translation matrix on the right.

' After the multiplication, the brush's transformation matrix represents a composite

' transformation: first scale, then translate. That composite transformation is applied to

' the brush's boundary path during the call to FillRectangle, so it is the area inside the

' transformed path that gets painted.

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

SUB Example_ResetTransform (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(50, 0), GDIP_POINT(50, 50)}

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

 

  pthGrBrush.ScaleTransform(3.0, 1.0)

  pthGrBrush.TranslateTransform(100.0, 50.0, MatrixOrderAppend)

 

  ' // Fill an area with the transformed path gradient brush.

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

 

  pthGrBrush.ResetTransform

 

  ' // Fill the same area with the path gradient brush (no transformation).

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

 

END SUB

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