Crée un objet Font (police)
#include <GDIPlus.au3>
_GDIPlus_FontCreate ( $hFamily, $fSize [, $iStyle = 0 [, $iUnit = 3]] )
$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 |
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*). |
Lorsque vous en avez terminé avec l'objet Font, appelez _GDIPlus_FontDispose() pour libérer les ressources.
Consultez GdipCreateFont dans la Library MSDN.
#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