#include <GDIPlus.au3>
_Example()
Func _Example()
GUICreate('')
GUISetState()
Local $iW_Txt = 80, $iH_Txt = 300
GUICtrlCreateLabel('', 50, 50, $iW_Txt, $iH_Txt)
Local $hPicWnd = GUICtrlGetHandle(-1)
_GDIPlus_Startup()
Local $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hPicWnd)
_GDIPlus_GraphicsSetSmoothingMode($hGraphic, $GDIP_SMOOTHINGMODE_HIGHQUALITY)
Local $hBrush = _GDIPlus_BrushCreateSolid(0xFFDD2200)
Local $hPath = _GDIPlus_PathCreate()
Local $hFamily = _GDIPlus_FontFamilyCreate('宋体')
Local $tLayout = _GDIPlus_RectFCreate()
_GDIPlus_PathAddString($hPath, '瘦', $tLayout, $hFamily)
Local $aBounds = _GDIPlus_PathGetWorldBounds($hPath)
Local $hMatrix = _GDIPlus_MatrixCreate()
_GDIPlus_MatrixTranslate($hMatrix, -$aBounds[0], -$aBounds[1])
_GDIPlus_MatrixScale($hMatrix, $iW_Txt / $aBounds[2], $iH_Txt / $aBounds[3], True)
_GDIPlus_PathTransform($hPath, $hMatrix)
_GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush)
Do
Until GUIGetMsg() = -3
_GDIPlus_MatrixDispose($hMatrix)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_PathDispose($hPath)
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
EndFunc ;==>_Example
|