描述
将该线性梯度刷的变换矩阵重置为同一矩阵.这意味着没有转换发生.
C++ Syntax
Status ResetTransform(); |
FreeBASIC 语法
FUNCTION ResetTransform () AS GpStatus |
参数
该方法没有参数.
返回值
如果该方法成功,则返回Ok,这是对Status枚举元素.
如果这个方法失败,它返回一个枚举的其他元素的Status.
引用文件
CGpBrush.inc (include CGdiPlus.inc)
示例
' ========================================================================================
' The following example creates a linear gradient brush and uses it to fill a rectangle.
' Next, the code sets the brush's transformation matrix, fills a rectangle with the
' transformed brush, resets the brush's transformation matrix, and fills a rectangle with
' the untransformed brush.
' ========================================================================================
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 S AS CGpMatrix = CGpMatrix(2, 0, 0, 1, 0, 0) ' // horizontal doubling
DIM rc AS GpRect = GDIP_RECT(0, 0, 200, 100)
DIM linGrBrush AS CGpLinearGradientBrush = CGpLinearGradientBrush(@rc, _
GDIP_ARGB(255, 255, 0, 0), GDIP_ARGB(255, 0, 0, 255), LinearGradientModeHorizontal)
' // Fill a large area with the gradient brush (no transformation).
graphics.FillRectangle(@linGrBrush, 0, 0, 800, 100)
' // Apply the scaling transformation.
linGrBrush.SetTransform(@S)
' // Fill a large area with the scaled gradient brush.
graphics.FillRectangle(@linGrBrush, 0, 150, 800, 100)
' // Reset the transformation
linGrBrush.ResetTransform
' // Fill a large area with the gradient brush (no transformation)
graphics.FillRectangle(@linGrBrush, 0, 300, 800, 100)
END SUB
' ========================================================================================