描述
获取一个对象,FontFamily指定一个通用的无衬线字体.
C++ Syntax
static const FontFamily* GenericSansSerif(); |
FreeBASIC 语法
FUNCTION GenericSansSerif ( _ BYVAL pFontFamily AS CGpFontFamily PTR _ ) AS GpStatus |
参数
pFontFamily
一个变量,将获得一个指向对象的指针FontFamily.
返回值
如果函数执行成功,则返回Ok,这是对Status枚举元素.
如果函数失败,则返回一个枚举的其他元素的Status.
引用文件
CGpFontFamily.inc (include CGdiPlus.inc)
示例
' ========================================================================================
' The following example creates a Font object by using a generic sans serif FontFamily
' object and then uses that Font object to draw text.
' ========================================================================================
SUB Example_GenericSansSerif (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)
' // Use a generic sans serif FontFamily object to create a Font object.
DIM fontFamily AS CGpFontFamily
fontFamily.GenericSansSerif(@fontFamily)
DIM genericSansSerifFont AS CGpFont = CGpFont(@fontFamily, AfxPointsToPixelsX(16) / rxRatio)
' // Draw text using the new font
DIM solidBrush AS CGpSolidBrush = GDIP_ARGB(255, 0, 0, 0)
graphics.DrawString("This is a generic sans serif font", -1, @genericSansSerifFont, 0, 0, @solidbrush)
END SUB
' ========================================================================================


