导航:  GdiPlus Classes > GdiPlus Classes > CGpBrush Class > Brush Object >

Clone

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

描述

 

现有Brush对象的内容到一个新的Brush对象.

 

C++ Syntax

 

Brush* Clone() const;

 

FreeBASIC 语法

 

FUNCTION Clone (BYVAL pBrush AS CGpBrush PTR) AS GpStatus

 

参数

 

pBrush

 

一个变量,将获得一个指向对象的指针Brush克隆.

 

返回值

 

如果函数执行成功,则返回Ok,这是对Status枚举元素.

如果函数失败,则返回一个枚举的其他元素的Status.

 

引用文件

 

CGpBrush.inc (include CGdiPlus.inc)

 

示例

 

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

' The following example creates a SolidBrush object, clones it, and then uses the clone

' to fill a rectangle.

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

SUB Example_CloneBrush (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

  ' // Set the scale transform

  graphics.ScaleTransform(rxRatio, rxRatio)

 

  ' // Create a SolidBrush object

  DIM solidBrush AS CGpSolidBrush = GDIP_ARGB(255, 255, 0, 0)

 

  ' // Create a clone of solidBrush

  DIM cloneBrush AS CGpSolidBrush

  solidBrush.Clone(@cloneBrush)

 

  ' // Use cloneBrush to fill a rectangle

  graphics.FillRectangle(@cloneBrush, 0, 0, 100, 100)

 

END SUB

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