描述
获取此字体家族的名称.
C++ Syntax
Status GetFamilyName( [out] WCHAR name[LF_FACESIZE], [in] WCHAR language ) const; |
FreeBASIC 语法
FUNCTION GetFamilyName ( _ BYVAL pwszName AS WSTRING PTR, _ BYVAL language AS LANGID = LANG_NEUTRAL _ ) AS GpStatus |
参数
pwszName
该字体家族[out]名称.
language
[in, optional]十六位的值,指定要使用的语言.默认值是LANG_NEUTRAL,是用户的默认语言.
返回值
如果函数执行成功,则返回Ok,这是对Status枚举元素.
如果函数失败,则返回一个枚举的其他元素的Status.
引用文件
CGpFontFamily.inc (include CGdiPlus.inc)
示例
' ========================================================================================
' The following example creates a FontFamily object, gets the family name, and outputs the
' name as text.
' ========================================================================================
SUB Example_GetFamilyName (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 FontFamily object
DIM nameFontFamily AS CGpFontFamily = "arial"
' // Get the cell ascent of the font family in design units.
DIM familyName AS WSTRING * LF_FACESIZE
nameFontFamily.GetFamilyName(@familyName)
' // Draw the family name
DIM solidBrush AS CGpSolidBrush = GDIP_ARGB(255, 0, 0, 0)
DIM font AS CGpFont = CGpFont(@nameFontFamily, AfxPointsToPixelsX(16) / rxRatio)
graphics.DrawString(@familyName, -1, @font, 0, 0, @solidbrush)
END SUB
' ========================================================================================


