描述
现有Font对象的内容到一个新的Font对象.
C++ Syntax
Font* Clone(); |
FreeBASIC 语法
FUNCTION Clone ( _ BYVAL pCloneFont AS CGpFont PTR _ ) AS GpStatus |
参数
pCloneFont
指针指向Font对象复制已有对象的内容.
引用文件
CGpLineCaps.inc (include CGdiPlus.inc)
示例
' ========================================================================================
' The following example creates a Font object, clones it, and then uses the clone to draw text.
' ========================================================================================
SUB Example_CloneFont (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 Font object.
DIM font AS CGpFont = CGpFont("Arial", AfxPointsToPixelsX(16) / rxRatio)
' // Create a clone of the Font object
DIM cloneFont AS CGpFont
font.Clone(@cloneFont)
' // Draw Text with cloneFont.
DIM solidBrush AS CGpSolidBrush = GDIP_ARGB(255, 0, 0, 0)
DIM wszText AS WSTRING * 260 = "This is a cloned Font"
graphics.DrawString(@wszText, -1, @cloneFont, 0, 0, @solidbrush)
END SUB
' ========================================================================================