UDF > GDIPlus > Font >


_GDIPlus_FontCreate

Cr�e un objet Font (police)

#include <GDIPlus.au3>
_GDIPlus_FontCreate ( $hFamily, $fSize [, $iStyle = 0 [, $iUnit = 3]] )

Param�tres

$hFamily Handle d'un objet Font Family (famille de polices)
$fSize La taille de la police mesur�e dans l'unit� sp�cifi�e dans le param�tre $iUnit
$iStyle [optionnel] Le style de la police. Peut �tre une combinaison des �l�ments suivants:
    0 - Graisse ou �paisseur normale
    1 - Gras
    2 - Italique
    4 - Soulign�
    8 - Barr�
$iUnit [optionnel] Unit� de mesure de la taille de la police:
    0 - Coordonn�es universelles, une unit� non physique
    1 - Unit� d'affichage
    2 - Unit� de 1 pixel
    3 - Unit� de 1 point d'imprimante (1/72 de pouce)
    4 - Unit� de 1 pouce
    5 - Unit� de 1/300 pouces
    6 - Unit� de 1 millim�tre

Valeur de retour

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

Remarque

Lorsque vous en avez termin� avec l'objet Font, appelez _GDIPlus_FontDispose() pour lib�rer les ressources.

En relation

_GDIPlus_FontDispose

Voir aussi

Consultez GdipCreateFont 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