函数参考


_GDIPlus_FontFamilyCreate

创建字体族对象

#Include <GDIPlus.au3>
_GDIPlus_FontFamilyCreate($sFamily)

参数

$sFamily 字体族名称

返回值

成功: 字体族对象句柄
失败: 返回 0

注意/说明

 当您完成字体族对象,调用_GDIPlus_FontFamilyDispose 释放资源

相关

_GDIPlus_FontFamilyDispose

详情参考

在MSDN中搜索


示例/演示


#include <GUIConstantsEx.au3>
#include <GDIPlus.au3>

_Main()

Func _Main()
    Local $hGUI, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout

    ; 创建 GUI
    $hGUI = GUICreate("GDI+", 400, 300)
    GUISetState()

    ; 描绘字符串
    _GDIPlus_Startup()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
    $hBrush = _GDIPlus_BrushCreateSolid(0x7F00007F)
    $hFormat = _GDIPlus_StringFormatCreate()
    $hFamily = _GDIPlus_FontFamilyCreate("Arial")
    $hFont = _GDIPlus_FontCreate($hFamily, 12, 2)
    $tLayout = _GDIPlus_RectFCreate(140, 110, 100, 20)
    _GDIPlus_GraphicsDrawStringEx($hGraphic, "Hello world", $hFont, $tLayout, $hFormat, $hBrush)

    ; 循环直到用户退出
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    ; 清理资源
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()

EndFunc   ;==>_Main