GDIPlus Animate Alpha Label UDF

  • Was mache ich falsch!!
    Das Udf funktioniert prima! aber Etwas stimmt nicht!!
    Bitte um Hilfe

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>
    #include <WinAPI.au3>
    #include <windowsconstants.au3>

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;===================================================================================================================================================================;
    ;========================================================================= Start Exemple ===========================================================================;
    HotKeySet('{Esc}', '_Exit')
    Global $icolor_red = 50, $icolor_green = 0, $icolor_blue = 100

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $GuiTrans = GUICreate("", 500, 500, -1, -1, $WS_POPUPWINDOW, $WS_EX_LAYERED)
    GUISetState()
    _GDIPlus_Startup()

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    For $A = 0 To 5
    Local $color = Changecolor()
    _GDIPlusAnimateAlphaLabel($GuiTrans, "Press Esc to exit script" & @CRLF & "Press Esc to exit script", 50, 30, 400, 100, "Comic Sans MS", 20, $color, 0, 1, $A, 255, 20)
    Sleep(500)
    Next
    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    _GDIPlus_Shutdown()
    Exit
    EndFunc ;==>_Exit

    [/autoit] [autoit][/autoit] [autoit]

    Func Changecolor()
    If $icolor_red < 255 Then
    $icolor_red += 5
    ElseIf $icolor_red = 255 Then
    $icolor_red = 0
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $icolor_green < 255 Then
    $icolor_green += 5
    ElseIf $icolor_green = 255 Then
    $icolor_green = 0
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $icolor_blue < 255 Then
    $icolor_blue += 5
    ElseIf $icolor_blue = 255 Then
    $icolor_blue = 0
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ConsoleWrite("Color : " & Hex($icolor_red, 2) & Hex($icolor_green, 2) & Hex($icolor_blue, 2) & @CRLF)
    Return Hex($icolor_red, 2) & Hex($icolor_green, 2) & Hex($icolor_blue, 2)
    EndFunc ;==>Changecolor

    [/autoit] [autoit][/autoit] [autoit]

    ;========================================================================= End Exemple =============================================================================;
    ;===================================================================================================================================================================;

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# =======================================================================================================================================================;
    ;Name...........: GDIPlusAnimateAlphaLabel
    ; Description ...: Animate Alpha Label
    ; Syntax.........: DrawInsert($GUIID, $LString, $LX, $LY, $LabelWidth , $LabelHeight, $LFont = "Comic Sans MS", $LSize = 10, _
    ; $Lcol = "000000", $LFormat = 0, $LType = 0, $AnType = 0, $TransValue = 255, $AnSpeed = 20)
    ; Author ........: Spayrosam(GetDot)
    ;===================================================================================================================================================================;
    Func _GDIPlusAnimateAlphaLabel($GUIID, $LString, $LX, $LY, $LabelWidth, $LabelHeight, $LFont = "Comic Sans MS", $LSize = 10, _
    $Lcol = "000000", $LFormat = 0, $LType = 0, $AnType = 0, $TransValue = 255, $AnSpeed = 20)
    If StringLeft($Lcol, 2) = "0x" Then $Lcol = StringTrimLeft($Lcol, 2)

    [/autoit] [autoit][/autoit] [autoit]

    $Data = _CreateGraphic($LabelWidth, $LabelHeight)
    Local $hBrush = _GDIPlus_BrushCreateSolid("0xFF" & $Lcol)
    Local $hFormat = _GDIPlus_StringFormatCreate(0)
    Local $hFamily = _GDIPlus_FontFamilyCreate($LFont)
    Local $hFont = _GDIPlus_FontCreate($hFamily, $LSize, $LFormat)
    Local $hLayout = _GDIPlus_RectFCreate($LX, $LY, 0, 0)
    Local $aInfo = _GDIPlus_GraphicsMeasureString($Data[2], $LString, $hFont, $hLayout, $hFormat)

    [/autoit] [autoit][/autoit] [autoit]

    If $LType = 1 Then
    Local $LabeltextResultW = DllStructGetData($aInfo[0], 3)
    Local $LabeltextResultH = DllStructGetData($aInfo[0], 4)
    Local $LabeltextResultN = DllStructGetData($aInfo[0], 1)
    $LYNew = ($LabelHeight - $LabeltextResultH) / 2
    $LXNew = ($LabelWidth - $LabeltextResultW) / 2
    $hLayout = _GDIPlus_RectFCreate($LXNew, $LYNew, 0, 0)
    $aInfo = _GDIPlus_GraphicsMeasureString($Data[2], $LString, $hFont, $hLayout, $hFormat)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $AnType = 0 Then
    _GDIPlus_GraphicsDrawStringEx($Data[2], $LString, $hFont, $aInfo[0], $hFormat, $hBrush)
    _SetCleanGraphic($GUIID, $Data[1], $LabelWidth, $LabelHeight, $TransValue, $Data[0])
    ElseIf $AnType = 1 Then
    For $DL = 0 To $LSize Step 1
    $Data = _CreateGraphic($LabelWidth, $LabelHeight)
    Local $hFont = _GDIPlus_FontCreate($hFamily, $DL, $LFormat)
    Local $aInfo = _GDIPlus_GraphicsMeasureString($Data[2], $LString, $hFont, $hLayout, $hFormat)
    If $LType = 1 Then
    Local $LabeltextResultW = DllStructGetData($aInfo[0], 3)
    Local $LabeltextResultH = DllStructGetData($aInfo[0], 4)
    $LYNew = ($LabelHeight - $LabeltextResultH) / 2
    $LXNew = ($LabelWidth - $LabeltextResultW) / 2
    $hLayout = _GDIPlus_RectFCreate($LXNew, $LYNew, 0, 0)
    $aInfo = _GDIPlus_GraphicsMeasureString($Data[2], $LString, $hFont, $hLayout, $hFormat)
    EndIf
    _GDIPlus_GraphicsDrawStringEx($Data[2], $LString, $hFont, $aInfo[0], $hFormat, $hBrush)
    _SetCleanGraphic($GUIID, $Data[1], $LabelWidth, $LabelHeight, $TransValue, $Data[0])
    Sleep($AnSpeed)
    Next
    ElseIf $AnType = 2 Then
    For $DL = $LSize To 0 Step -1
    $Data = _CreateGraphic($LabelWidth, $LabelHeight)
    Local $hFont = _GDIPlus_FontCreate($hFamily, $DL, $LFormat)
    Local $aInfo = _GDIPlus_GraphicsMeasureString($Data[2], $LString, $hFont, $hLayout, $hFormat)
    If $LType = 1 Then
    Local $LabeltextResultW = DllStructGetData($aInfo[0], 3)
    Local $LabeltextResultH = DllStructGetData($aInfo[0], 4)
    $LYNew = ($LabelHeight - $LabeltextResultH) / 2
    $LXNew = ($LabelWidth - $LabeltextResultW) / 2
    $hLayout = _GDIPlus_RectFCreate($LXNew, $LYNew, 0, 0)
    $aInfo = _GDIPlus_GraphicsMeasureString($Data[2], $LString, $hFont, $hLayout, $hFormat)
    EndIf
    _GDIPlus_GraphicsDrawStringEx($Data[2], $LString, $hFont, $aInfo[0], $hFormat, $hBrush)
    _SetCleanGraphic($GUIID, $Data[1], $LabelWidth, $LabelHeight, $TransValue, $Data[0])
    Sleep($AnSpeed)
    Next
    ElseIf $AnType = 3 Then
    Local $LStringAdd = ""
    For $ANI = 1 To $LabeltextResultN Step 1
    $Data = _CreateGraphic($LabelWidth, $LabelHeight)
    $LStringAdd = StringLeft($LString, $ANI)
    _GDIPlus_GraphicsDrawStringEx($Data[2], $LStringAdd, $hFont, $aInfo[0], $hFormat, $hBrush)
    _SetCleanGraphic($GUIID, $Data[1], $LabelWidth, $LabelHeight, $TransValue, $Data[0])
    If $LStringAdd = $LString Then ExitLoop
    Sleep($AnSpeed)
    Next
    ElseIf $AnType = 4 Then
    Local $LStringDel = $LString
    For $ANI = $LabeltextResultN To 0 Step -1
    $Data = _CreateGraphic($LabelWidth, $LabelHeight)
    $LStringDel = StringTrimRight($LStringDel, 1)
    _GDIPlus_GraphicsDrawStringEx($Data[2], $LStringDel, $hFont, $aInfo[0], $hFormat, $hBrush)
    _SetCleanGraphic($GUIID, $Data[1], $LabelWidth, $LabelHeight, $TransValue, $Data[0])
    If $LStringDel = "" Then ExitLoop
    Sleep($AnSpeed)
    Next
    ElseIf $AnType = 5 Then
    _GDIPlus_GraphicsDrawStringEx($Data[2], $LString, $hFont, $aInfo[0], $hFormat, $hBrush)
    $CloneLabel = _GDIPlus_BitmapCloneArea($Data[1], 0, 0, $LabelWidth, $LabelHeight, $GDIP_PXF32ARGB)

    [/autoit] [autoit][/autoit] [autoit]

    $CloneLabel2 = _GDIPlus_BitmapCloneArea($Data[1], 0, 0, $LabelWidth, $LabelHeight, $GDIP_PXF32ARGB)
    _GDIPlus_ImageRotateFlip($CloneLabel2, 4)
    $valueRotateLabe = $LabelWidth / 20
    For $ANI = $LabelWidth To 0 Step -$valueRotateLabe
    $Data = _CreateGraphic($LabelWidth, $LabelHeight)
    $XRotateLabe = ($LabelWidth - $ANI) / 2
    _GDIPlus_GraphicsDrawImageRect($Data[2], $CloneLabel, $XRotateLabe, 0, $ANI, $LabelHeight)
    _SetCleanGraphic($GUIID, $Data[1], $LabelWidth, $LabelHeight, $TransValue, $Data[0])
    Sleep($AnSpeed)
    Next
    For $ANI = 0 To $LabelWidth Step $valueRotateLabe
    $Data = _CreateGraphic($LabelWidth, $LabelHeight)
    $XRotateLabe = ($LabelWidth - $ANI) / 2
    _GDIPlus_GraphicsDrawImageRect($Data[2], $CloneLabel2, $XRotateLabe, 0, $ANI, $LabelHeight)
    _SetCleanGraphic($GUIID, $Data[1], $LabelWidth, $LabelHeight, $TransValue, $Data[0])
    Sleep($AnSpeed)
    Next
    For $ANI = $LabelWidth To 0 Step -$valueRotateLabe
    $Data = _CreateGraphic($LabelWidth, $LabelHeight)
    $XRotateLabe = ($LabelWidth - $ANI) / 2
    _GDIPlus_GraphicsDrawImageRect($Data[2], $CloneLabel2, $XRotateLabe, 0, $ANI, $LabelHeight)
    _SetCleanGraphic($GUIID, $Data[1], $LabelWidth, $LabelHeight, $TransValue, $Data[0])
    Sleep($AnSpeed)
    Next
    For $ANI = 0 To $LabelWidth Step $valueRotateLabe
    $Data = _CreateGraphic($LabelWidth, $LabelHeight)
    $XRotateLabe = ($LabelWidth - $ANI) / 2
    _GDIPlus_GraphicsDrawImageRect($Data[2], $CloneLabel, $XRotateLabe, 0, $ANI, $LabelHeight)
    _SetCleanGraphic($GUIID, $Data[1], $LabelWidth, $LabelHeight, $TransValue, $Data[0])
    Sleep($AnSpeed)
    Next
    _WinAPI_DeleteObject($CloneLabel)
    _WinAPI_DeleteObject($CloneLabel2)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BrushDispose($hBrush)
    EndFunc ;==>_GDIPlusAnimateAlphaLabel

    [/autoit] [autoit][/autoit] [autoit]

    Func _CreateGraphic($GW, $GH)
    Dim $ReturnData[3]
    Global $Gui
    $Graphics = _GDIPlus_GraphicsCreateFromHWND($Gui)
    $hImageL = _GDIPlus_BitmapCreateFromGraphics($GW, $GH, $Graphics)
    $hGraphicL = _GDIPlus_ImageGetGraphicsContext($hImageL)
    $ReturnData[0] = $Graphics
    $ReturnData[1] = $hImageL
    $ReturnData[2] = $hGraphicL
    Return $ReturnData
    EndFunc ;==>_CreateGraphic

    [/autoit] [autoit][/autoit] [autoit]

    Func _SetCleanGraphic($IDLabel, $BitmapImage, $GW, $GH, $Trans, $CleanGraphics)
    SetBitmap($IDLabel, $BitmapImage, $Trans, $GW, $GH)
    _GDIPlus_GraphicsDispose($CleanGraphics)
    _GDIPlus_BitmapDispose($BitmapImage)
    EndFunc ;==>_SetCleanGraphic

    [/autoit] [autoit][/autoit] [autoit]

    Func _GDIPlus_ImageRotateFlip($hImage, $rfType)
    Local $aResult
    $aResult = DllCall($ghGDIPDll, "int", "GdipImageRotateFlip", "hwnd", $hImage, "long", $rfType)
    If @error Then Return SetError(@error, @extended, False)
    Return SetError($aResult[0], 0, $aResult[0] = 0)
    EndFunc ;==>_GDIPlus_ImageRotateFlip

    [/autoit] [autoit][/autoit] [autoit]

    Func SetBitmap($hGUI, $hImage, $iOpacity, $iW, $iH)
    Local $hScrDC = _WinAPI_GetDC(0)
    Local $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
    Local $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    Local $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)
    $TSize = DllStructCreate("long X;long Y")
    $pSize = DllStructGetPtr($TSize)
    DllStructSetData($TSize, "X", $iW)
    DllStructSetData($TSize, "Y", $iH)
    $tSource = DllStructCreate("long X;long Y")
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate("byte Op;byte Flags;byte Alpha;byte Format")
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", $iOpacity)
    DllStructSetData($tBlend, "Format", 1)
    _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, 0x02)
    _WinAPI_ReleaseDC(0, $hScrDC)
    _WinAPI_SelectObject($hMemDC, $hOld)
    _WinAPI_DeleteObject($hBitmap)
    _WinAPI_DeleteDC($hMemDC)
    EndFunc ;==>SetBitmap

    [/autoit]

    Edit:
    Bitte ändere zeile 75 bis 83. Sonst gibt es einen Fehler ($LType = 0)

    [autoit]

    If $LType = 1 Then
    Local $LabeltextResultW = DllStructGetData($aInfo[0], 3)
    Local $LabeltextResultH = DllStructGetData($aInfo[0], 4)
    $LYNew = ($LabelHeight - $LabeltextResultH) / 2
    $LXNew = ($LabelWidth - $LabeltextResultW) / 2
    $hLayout = _GDIPlus_RectFCreate($LXNew, $LYNew, 0, 0)
    $aInfo = _GDIPlus_GraphicsMeasureString($Data[2], $LString, $hFont, $hLayout, $hFormat)
    EndIf
    Local $LabeltextResultN = DllStructGetData($aInfo[0], 1)

    [/autoit]

    Problem ist der CPU auslastung

    2 Mal editiert, zuletzt von getdot (1. Oktober 2011 um 01:37) aus folgendem Grund: [Gelöst]

  • Problem ist der CPU auslastung


    Bei der CPU Auslastung ist mir jetzt nichts aufgefallen - allerdings beim Reservierten Arbeitsspeicher schon.
    Das kommt einfach daher, dass im ganzen Script teilweise Ressourcen nicht wieder freigegeben werden.

    Als Beispiel sei hier nur mal $hFont in _GDIPlusAnimateAlphaLabel() gegeben, das in manchen Fällen 2x erstellt, aber nur 1x freigegeben wird. (z.B. wenn $AnType = 1 oder 2 ist).
    Ein _GDIPlus_FontDispose($hFont) vor den jeweiligen Stellen (z. 91 & 108) hilft da etwas.

    Außerdem wird das in _CreateGraphic erstellte Graphics-Objekt (_GDIPLus_ImageGetGraphicsContext) in _SetCleanGraphic nicht gelöscht (_GDIPlus_GraphicsDispose !).
    Das scheint aber noch nicht alles gewesen zu sein - der RAM Verbrauch steigt weiterhin - wenn auch langsamer.

    Ich hab allerdings keine Lust und Muße mehr, mich da noch weiter reinzuarbeiten.
    Ich hoffe ich hab jedenfalls schonmal einen Schubser in die richtige Richtung geben können.

  • SEuBo Ich danke dir ;)

    Hier UDF mit Example

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>
    #include <WinAPI.au3>
    #include <windowsconstants.au3>

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;===================================================================================================================================================================;
    ;========================================================================= Start Example ===========================================================================;
    HotKeySet('{Esc}', '_Exit')
    Global $icolor_red = 0, $icolor_green = 0, $icolor_blue = 0
    Local $color

    [/autoit] [autoit][/autoit] [autoit]

    $GuiTrans = GUICreate("", @DesktopWidth, @DesktopHeight, -1, -1, $WS_POPUPWINDOW, $WS_EX_LAYERED)
    GUISetState()
    _GDIPlus_Startup()
    AdlibRegister("Changecolor")
    While 1
    For $A = 0 To 8
    _GDIPlusAnimateAlphaLabel($GuiTrans, "Press Esc to exit script 1" & @CRLF & "Press Esc to exit script 2", 50, 30, _
    @DesktopWidth - 100, @DesktopHeight - 60, "Comic Sans MS", 20, $color, 0, 1, $A, 255, 20, 8)
    Sleep(1000)
    Next
    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    _GDIPlus_Shutdown()
    Exit
    EndFunc ;==>_Exit

    [/autoit] [autoit][/autoit] [autoit]

    Func Changecolor()
    If $icolor_red < 255 Then
    $icolor_red += 1
    ElseIf $icolor_red = 255 Then
    $icolor_red = 0
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $icolor_green < 255 Then
    $icolor_green += 2
    ElseIf $icolor_green = 255 Then
    $icolor_green = 0
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $icolor_blue < 255 Then
    $icolor_blue += 3
    ElseIf $icolor_blue = 255 Then
    $icolor_blue = 0
    EndIf
    ConsoleWrite("Color : " & Hex($icolor_red, 2) & Hex($icolor_green, 2) & Hex($icolor_blue, 2) & @CRLF)
    $color = Hex($icolor_red, 2) & Hex($icolor_green, 2) & Hex($icolor_blue, 2)
    EndFunc ;==>Changecolor

    [/autoit] [autoit][/autoit] [autoit]

    ;=========================================================================EndExample=============================================================================;
    ;===================================================================================================================================================================;

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# =======================================================================================================================================================;
    ;Name...........: GDIPlusAnimateAlphaLabel
    ; Description ...: Animate Alpha Label (9 EFFECT)
    ; Syntax.........: DrawInsert($GUIID, $LString, $LX, $LY, $LabelWidth , $LabelHeight, $LFont = "Comic Sans MS", $LSize = 10, _
    ; $Lcol = "000000", $LFormat = 0, $LType = 0, $AnType = 0, $TransValue = 255, $AnSpeed = 20, $SpeedRotation = 10)
    ; Author ........: Spayrosam(GetDot)
    ;===================================================================================================================================================================;
    Func _GDIPlusAnimateAlphaLabel($GUIID, $LString, $LX, $LY, $LabelWidth, $LabelHeight, $LFont = "Comic Sans MS", $LSize = 10, _
    $Lcol = "000000", $LFormat = 0, $LType = 0, $AnType = 0, $TransValue = 255, $AnSpeed = 20, $SpeedRotation = 10)
    If StringLeft($Lcol, 2) = "0x" Then $Lcol = StringTrimLeft($Lcol, 2)
    Local $DemaANI = 1
    $Data = _CreateGraphic($LabelWidth, $LabelHeight)
    Local $hBrush = _GDIPlus_BrushCreateSolid("0xFF" & $Lcol)
    Local $hFormat = _GDIPlus_StringFormatCreate(0)
    Local $hFamily = _GDIPlus_FontFamilyCreate($LFont)
    Local $hFont = _GDIPlus_FontCreate($hFamily, $LSize, $LFormat)
    Local $hLayout = _GDIPlus_RectFCreate($LX, $LY, 0, 0)
    Local $aInfo = _GDIPlus_GraphicsMeasureString($Data[2], $LString, $hFont, $hLayout, $hFormat)

    [/autoit] [autoit][/autoit] [autoit]

    If $LType = 1 Then
    Local $LabeltextResultW = DllStructGetData($aInfo[0], 3)
    Local $LabeltextResultH = DllStructGetData($aInfo[0], 4)
    $LYNew = ($LabelHeight - $LabeltextResultH) / 2
    $LXNew = ($LabelWidth - $LabeltextResultW) / 2
    $hLayout = _GDIPlus_RectFCreate($LXNew, $LYNew, 0, 0)
    $aInfo = _GDIPlus_GraphicsMeasureString($Data[2], $LString, $hFont, $hLayout, $hFormat)
    EndIf
    Local $LabeltextResultN = StringLen($LString)

    [/autoit] [autoit][/autoit] [autoit]

    If $AnType = 0 Then
    _GDIPlus_GraphicsDrawStringEx($Data[2], $LString, $hFont, $aInfo[0], $hFormat, $hBrush)
    _SetCleanGraphic($GUIID, $Data[1], $LabelWidth, $LabelHeight, $TransValue, $Data[0], $Data[2])
    ElseIf $AnType = 1 Then
    For $DL = 0 To $LSize Step 1
    If $DemaANI <> 1 Then $Data = _CreateGraphic($LabelWidth, $LabelHeight)
    Local $hFont = _GDIPlus_FontCreate($hFamily, $DL, $LFormat)
    Local $aInfo = _GDIPlus_GraphicsMeasureString($Data[2], $LString, $hFont, $hLayout, $hFormat)
    If $LType = 1 Then
    Local $LabeltextResultW = DllStructGetData($aInfo[0], 3)
    Local $LabeltextResultH = DllStructGetData($aInfo[0], 4)
    $LYNew = ($LabelHeight - $LabeltextResultH) / 2
    $LXNew = ($LabelWidth - $LabeltextResultW) / 2
    $hLayout = _GDIPlus_RectFCreate($LXNew, $LYNew, 0, 0)
    $aInfo = _GDIPlus_GraphicsMeasureString($Data[2], $LString, $hFont, $hLayout, $hFormat)
    EndIf
    _GDIPlus_GraphicsDrawStringEx($Data[2], $LString, $hFont, $aInfo[0], $hFormat, $hBrush)
    _SetCleanGraphic($GUIID, $Data[1], $LabelWidth, $LabelHeight, $TransValue, $Data[0], $Data[2])
    Sleep($AnSpeed)
    $DemaANI = 0
    Next
    ElseIf $AnType = 2 Then
    For $DL = $LSize To 0 Step -1
    If $DemaANI <> 1 Then $Data = _CreateGraphic($LabelWidth, $LabelHeight)
    Local $hFont = _GDIPlus_FontCreate($hFamily, $DL, $LFormat)
    Local $aInfo = _GDIPlus_GraphicsMeasureString($Data[2], $LString, $hFont, $hLayout, $hFormat)
    If $LType = 1 Then
    Local $LabeltextResultW = DllStructGetData($aInfo[0], 3)
    Local $LabeltextResultH = DllStructGetData($aInfo[0], 4)
    $LYNew = ($LabelHeight - $LabeltextResultH) / 2
    $LXNew = ($LabelWidth - $LabeltextResultW) / 2
    $hLayout = _GDIPlus_RectFCreate($LXNew, $LYNew, 0, 0)
    $aInfo = _GDIPlus_GraphicsMeasureString($Data[2], $LString, $hFont, $hLayout, $hFormat)
    EndIf
    _GDIPlus_GraphicsDrawStringEx($Data[2], $LString, $hFont, $aInfo[0], $hFormat, $hBrush)
    _SetCleanGraphic($GUIID, $Data[1], $LabelWidth, $LabelHeight, $TransValue, $Data[0], $Data[2])
    Sleep($AnSpeed)
    $DemaANI = 0
    Next
    ElseIf $AnType = 3 Then
    Local $LStringAdd = ""
    For $ANI = 1 To $LabeltextResultN Step 1
    If $DemaANI <> 1 Then $Data = _CreateGraphic($LabelWidth, $LabelHeight)
    $LStringAdd = StringLeft($LString, $ANI)
    _GDIPlus_GraphicsDrawStringEx($Data[2], $LStringAdd, $hFont, $aInfo[0], $hFormat, $hBrush)
    _SetCleanGraphic($GUIID, $Data[1], $LabelWidth, $LabelHeight, $TransValue, $Data[0], $Data[2])
    If $LStringAdd = $LString Then ExitLoop
    Sleep($AnSpeed)
    $DemaANI = 0
    Next
    ElseIf $AnType = 4 Then
    Local $LStringDel = $LString
    For $ANI = $LabeltextResultN To 0 Step -1
    If $DemaANI <> 1 Then $Data = _CreateGraphic($LabelWidth, $LabelHeight)
    $LStringDel = StringTrimRight($LStringDel, 1)
    _GDIPlus_GraphicsDrawStringEx($Data[2], $LStringDel, $hFont, $aInfo[0], $hFormat, $hBrush)
    _SetCleanGraphic($GUIID, $Data[1], $LabelWidth, $LabelHeight, $TransValue, $Data[0], $Data[2])
    If $LStringDel = "" Then ExitLoop
    Sleep($AnSpeed)
    $DemaANI = 0
    Next
    ElseIf $AnType = 5 Then
    Local $LStringAdd = ""
    For $ANI = 1 To $LabeltextResultN Step 1
    If $DemaANI <> 1 Then $Data = _CreateGraphic($LabelWidth, $LabelHeight)
    $LStringAdd = StringRight($LString, $ANI)
    _GDIPlus_GraphicsDrawStringEx($Data[2], $LStringAdd, $hFont, $aInfo[0], $hFormat, $hBrush)
    _SetCleanGraphic($GUIID, $Data[1], $LabelWidth, $LabelHeight, $TransValue, $Data[0], $Data[2])
    If $LStringAdd = $LString Then ExitLoop
    Sleep($AnSpeed)
    $DemaANI = 0
    Next
    ElseIf $AnType = 6 Then
    Local $LStringDel = $LString
    For $ANI = $LabeltextResultN To 0 Step -1
    If $DemaANI <> 1 Then $Data = _CreateGraphic($LabelWidth, $LabelHeight)
    $LStringDel = StringTrimLeft($LStringDel, 1)
    _GDIPlus_GraphicsDrawStringEx($Data[2], $LStringDel, $hFont, $aInfo[0], $hFormat, $hBrush)
    _SetCleanGraphic($GUIID, $Data[1], $LabelWidth, $LabelHeight, $TransValue, $Data[0], $Data[2])
    If $LStringDel = "" Then ExitLoop
    Sleep($AnSpeed)
    $DemaANI = 0
    Next

    [/autoit] [autoit][/autoit] [autoit]

    ElseIf $AnType = 7 Then
    _GDIPlus_GraphicsDrawStringEx($Data[2], $LString, $hFont, $aInfo[0], $hFormat, $hBrush)
    $CloneLabel = _GDIPlus_BitmapCloneArea($Data[1], 0, 0, $LabelWidth, $LabelHeight, $GDIP_PXF32ARGB)
    $CloneLabel2 = _GDIPlus_BitmapCloneArea($Data[1], 0, 0, $LabelWidth, $LabelHeight, $GDIP_PXF32ARGB)
    DllCall($ghGDIPDll, "int", "GdipImageRotateFlip", "hwnd", $CloneLabel2, "long", 4)
    $valueRotateLabe = $LabelWidth / $SpeedRotation
    For $ANI = $LabelWidth To 0 Step -$valueRotateLabe
    If $DemaANI <> 1 Then $Data = _CreateGraphic($LabelWidth, $LabelHeight)
    $XRotateLabe = ($LabelWidth - $ANI) / 2
    _GDIPlus_GraphicsDrawImageRect($Data[2], $CloneLabel, $XRotateLabe, 0, $ANI, $LabelHeight)
    _SetCleanGraphic($GUIID, $Data[1], $LabelWidth, $LabelHeight, $TransValue, $Data[0], $Data[2])
    Sleep($AnSpeed)
    $DemaANI = 0
    Next
    For $ANI = 0 To $LabelWidth Step $valueRotateLabe
    $Data = _CreateGraphic($LabelWidth, $LabelHeight)
    $XRotateLabe = ($LabelWidth - $ANI) / 2
    _GDIPlus_GraphicsDrawImageRect($Data[2], $CloneLabel2, $XRotateLabe, 0, $ANI, $LabelHeight)
    _SetCleanGraphic($GUIID, $Data[1], $LabelWidth, $LabelHeight, $TransValue, $Data[0], $Data[2])
    Sleep($AnSpeed)
    Next
    For $ANI = $LabelWidth To 0 Step -$valueRotateLabe
    $Data = _CreateGraphic($LabelWidth, $LabelHeight)
    $XRotateLabe = ($LabelWidth - $ANI) / 2
    _GDIPlus_GraphicsDrawImageRect($Data[2], $CloneLabel2, $XRotateLabe, 0, $ANI, $LabelHeight)
    _SetCleanGraphic($GUIID, $Data[1], $LabelWidth, $LabelHeight, $TransValue, $Data[0], $Data[2])
    Sleep($AnSpeed)
    Next
    For $ANI = 0 To $LabelWidth Step $valueRotateLabe
    $Data = _CreateGraphic($LabelWidth, $LabelHeight)
    $XRotateLabe = ($LabelWidth - $ANI) / 2
    _GDIPlus_GraphicsDrawImageRect($Data[2], $CloneLabel, $XRotateLabe, 0, $ANI, $LabelHeight)
    _SetCleanGraphic($GUIID, $Data[1], $LabelWidth, $LabelHeight, $TransValue, $Data[0], $Data[2])
    Sleep($AnSpeed)
    Next
    _GDIPlus_BitmapDispose($CloneLabel)
    _GDIPlus_BitmapDispose($CloneLabel2)
    ElseIf $AnType = 8 Then
    _GDIPlus_GraphicsDrawStringEx($Data[2], $LString, $hFont, $aInfo[0], $hFormat, $hBrush)
    $CloneLabel = _GDIPlus_BitmapCloneArea($Data[1], 0, 0, $LabelWidth, $LabelHeight, $GDIP_PXF32ARGB)
    $CloneLabel2 = _GDIPlus_BitmapCloneArea($Data[1], 0, 0, $LabelWidth, $LabelHeight, $GDIP_PXF32ARGB)
    DllCall($ghGDIPDll, "int", "GdipImageRotateFlip", "hwnd", $CloneLabel2, "long", 6)
    $valueRotateLabe = $LabelHeight / $SpeedRotation
    For $ANI = $LabelHeight To 0 Step -$valueRotateLabe
    If $DemaANI <> 1 Then $Data = _CreateGraphic($LabelWidth, $LabelHeight)
    $YRotateLabe = ($LabelHeight - $ANI) / 2
    _GDIPlus_GraphicsDrawImageRect($Data[2], $CloneLabel, 0, $YRotateLabe, $LabelWidth, $ANI)
    _SetCleanGraphic($GUIID, $Data[1], $LabelWidth, $LabelHeight, $TransValue, $Data[0], $Data[2])
    Sleep($AnSpeed)
    $DemaANI = 0
    Next
    For $ANI = 0 To $LabelHeight Step $valueRotateLabe
    $Data = _CreateGraphic($LabelWidth, $LabelHeight)
    $YRotateLabe = ($LabelHeight - $ANI) / 2
    _GDIPlus_GraphicsDrawImageRect($Data[2], $CloneLabel2, 0, $YRotateLabe, $LabelWidth, $ANI)
    _SetCleanGraphic($GUIID, $Data[1], $LabelWidth, $LabelHeight, $TransValue, $Data[0], $Data[2])
    Sleep($AnSpeed)
    Next
    For $ANI = $LabelHeight To 0 Step -$valueRotateLabe
    $Data = _CreateGraphic($LabelWidth, $LabelHeight)
    $YRotateLabe = ($LabelHeight - $ANI) / 2
    _GDIPlus_GraphicsDrawImageRect($Data[2], $CloneLabel2, 0, $YRotateLabe, $LabelWidth, $ANI)
    _SetCleanGraphic($GUIID, $Data[1], $LabelWidth, $LabelHeight, $TransValue, $Data[0], $Data[2])
    Sleep($AnSpeed)
    Next
    For $ANI = 0 To $LabelHeight Step $valueRotateLabe
    $Data = _CreateGraphic($LabelWidth, $LabelHeight)
    $YRotateLabe = ($LabelHeight - $ANI) / 2
    _GDIPlus_GraphicsDrawImageRect($Data[2], $CloneLabel, 0, $YRotateLabe, $LabelWidth, $ANI)
    _SetCleanGraphic($GUIID, $Data[1], $LabelWidth, $LabelHeight, $TransValue, $Data[0], $Data[2])
    Sleep($AnSpeed)
    Next
    _GDIPlus_BitmapDispose($CloneLabel)
    _GDIPlus_BitmapDispose($CloneLabel2)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BrushDispose($hBrush)
    EndFunc ;==>_GDIPlusAnimateAlphaLabel

    [/autoit] [autoit][/autoit] [autoit]

    Func _CreateGraphic($GW, $GH)
    Dim $ReturnData[3]
    Global $Gui
    $graphics = _GDIPlus_GraphicsCreateFromHWND($Gui)
    $hImageL = _GDIPlus_BitmapCreateFromGraphics($GW, $GH, $graphics)
    $hGraphicL = _GDIPlus_ImageGetGraphicsContext($hImageL)
    $ReturnData[0] = $graphics
    $ReturnData[1] = $hImageL
    $ReturnData[2] = $hGraphicL
    Return $ReturnData
    EndFunc ;==>_CreateGraphic

    [/autoit] [autoit][/autoit] [autoit]

    Func _SetCleanGraphic($IDLabel, $BitmapImage, $GW, $GH, $Trans, $CleanGraphics, $CleanGraphicsContext)
    SetBitmap($IDLabel, $BitmapImage, $Trans, $GW, $GH)
    _GDIPlus_GraphicsDispose($CleanGraphics)
    _GDIPlus_BitmapDispose($BitmapImage)
    _GDIPlus_GraphicsDispose($CleanGraphicsContext)
    EndFunc ;==>_SetCleanGraphic

    [/autoit] [autoit][/autoit] [autoit]

    Func SetBitmap($hGUI, $hImage, $iOpacity, $iW, $iH)
    Local $hScrDC = _WinAPI_GetDC(0)
    Local $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
    Local $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    Local $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)
    $TSize = DllStructCreate("long X;long Y")
    $pSize = DllStructGetPtr($TSize)
    DllStructSetData($TSize, "X", $iW)
    DllStructSetData($TSize, "Y", $iH)
    $tSource = DllStructCreate("long X;long Y")
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate("byte Op;byte Flags;byte Alpha;byte Format")
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", $iOpacity)
    DllStructSetData($tBlend, "Format", 1)
    _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, 0x02)
    _WinAPI_ReleaseDC(0, $hScrDC)
    _WinAPI_SelectObject($hMemDC, $hOld)
    _WinAPI_DeleteObject($hBitmap)
    _WinAPI_DeleteDC($hMemDC)
    EndFunc ;==>SetBitmap

    [/autoit]


    Vielleicht kann es ja jemand gebrauchen