Animiertes GIF in GUI

    • Offizieller Beitrag

    Das geht wahrscheinlich nur über den Umweg über einen eingebetteten IE!

    [autoit]

    #include <GUIConstants.au3>
    #include <ie.au3>

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

    $oIE = _IECreateEmbedded()

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

    GUICreate ("My GUI Animation",300,300)
    $ani1 = GUICtrlCreateObj ($oIE,30, 30, 250,250)

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

    GUISetState( )
    _IENavigate($oIE,@ScriptDir & "\antenne.gif")

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

    ; Run the GUI until the dialog is closed
    While 1
    $msg = GUIGetMsg()

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

    Select
    case $msg = $GUI_EVENT_CLOSE
    ExitLoop

    EndSelect
    Wend

    [/autoit]
    • Offizieller Beitrag

    Hi,

    Spoiler anzeigen
    [autoit]

    #include-once
    ;===============================================================================
    ;
    ; Function Name: _GUICtrlCreateGIF()
    ; Description: Create an Animated GIF control
    ; Parameter(s): $gif [required] path and filename of the animated GIF
    ; $x [optional] x pos of the top-left corner
    ; $y [optional] y pos of the top-left corner
    ; $border [optional] 0 = no border
    ; any other = sunken border
    ; Requirement(s): #include <IE.au3>
    ; Return Value(s):
    ; controlID of the control created
    ; Author(s): elgabionline, gafrost, Ed_Maximized
    ;
    ;===============================================================================
    Func _GUICtrlCreateGIF($gif,$x=0,$y=0,$border=0)
    Local $pwidth,$pheight,$oIE,$GUIActiveX
    _GetGifPixWidth_Height($gif, $pwidth, $pheight)
    $oIE = ObjCreate("Shell.Explorer.2")
    $GUIActiveX = GUICtrlCreateObj($oIE, $x, $y, $pwidth, $pheight)
    $oIE.navigate ("about:blank")
    While _IEPropertyGet($oIE, "busy")
    Sleep(100)
    WEnd
    $oIE.document.body.background = $gif
    $oIE.document.body.scroll = "no"
    if $border=0 then $oIE.document.body.style.border = "0px"
    Return $oIE
    EndFunc
    ;===============================================================================
    ;
    ; Function Name: _GUICtrlStopGIF()
    ; Description: stop an Animated GIF control created with _GUICtrlCreateGIF()
    ; Parameter(s): $Control [required] controlID of the control returned by _GUICtrlCreateGIF()
    ;
    ; Requirement(s): #include <IE.au3>
    ; Return Value(s):
    ; none
    ; Author(s): lod3n, Ed_Maximized
    ;
    ;===============================================================================
    Func _GUICtrlStopGIF($Control)
    _IEAction ($Control, "stop" ) ; stop
    EndFunc
    ;===============================================================================
    ;
    ; Function Name: _GUICtrlResumeGIF()
    ; Description: resume an Animated GIF control created with _GUICtrlCreateGIF()
    ; Parameter(s): $Control [required] controlID of the control returned by _GUICtrlCreateGIF()
    ;
    ; Requirement(s): #include <IE.au3>
    ; Return Value(s):
    ; none
    ; Author(s): lod3n, Ed_Maximized
    ;
    ;===============================================================================
    Func _GUICtrlResumeGIF($Control)
    $Control.document.body.background = $Control.document.body.background ;resume
    EndFunc
    ;===============================================================================
    ;
    ; Function Name: _GetGifPixWidth_Height()
    ; Description: return the size of a GIF image in pixels
    ; Parameter(s): $s_gif [required] path and filename of the animated GIF
    ;
    ; Requirement(s): #include <IE.au3>
    ; Return Value(s):
    ; $pwidth = width of the GIF in pixels
    ; $pheight = height of the GIF in pixels
    ; Author(s): gafrost
    ;
    ;===============================================================================
    Func _GetGifPixWidth_Height($s_gif, ByRef $pwidth, ByRef $pheight)
    If FileGetSize($s_gif) > 9 Then
    Local $sizes = FileRead($s_gif, 10)
    ConsoleWrite("Gif version: " & StringMid($sizes, 1, 6) & @LF)
    $pwidth = Asc(StringMid($sizes, 8, 1)) * 256 + Asc(StringMid($sizes, 7, 1))
    $pheight = Asc(StringMid($sizes, 10, 1)) * 256 + Asc(StringMid($sizes, 9, 1))
    ConsoleWrite($pwidth & " x " & $pheight & @LF)
    EndIf
    EndFunc ;==>_GetGifPixWidth_Height

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

    So long,

    Mega