UDF > GDIPlus > FontFamily >


_GDIPlus_FontFamilyCreate

Cr�e un objet FontFamily (famille de polices)

#include <GDIPlus.au3>
_GDIPlus_FontFamilyCreate ( $sFamily [, $pCollection = 0] )

Param�tres

$sFamily Nom de la famille de polices
$pCollection [optionnel] Handle de l'objet FontCollection qui sp�cifie la collection � laquelle la famille de polices appartient.

Valeur de retour

Succ�s: Retourne le handle de l'objet FontFamily.
�chec: Retourne 0 et d�finit @error <> 0, @extended contient le code erreur GPSTATUS ($GPID_ERR*).

Remarque

Lorsque vous en avez termin� avec la famille de polices, appelez _GDIPlus_FontFamilyDispose() pour lib�rer les ressources.

En relation

_GDIPlus_FontFamilyDispose

Voir aussi

Consultez GdipCreateFontFamilyFromName dans la Library MSDN.

Exemple

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

Example()

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

    ; Cr�e une GUI
    $hGUI = GUICreate("GDI+", 400, 300)
    GUISetState(@SW_SHOW)

    ; Dessine une cha�ne
    _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)

    ; Boucle jusqu'� ce que l'utilisateur quitte.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    ; Nettoie les ressources
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
EndFunc   ;==>Example