Win fast True Trans

  • Moien.

    Ich habe vor kurzen eine UDF geschrieben, die mir ein Einblent effekt liefert.

    Dies habe ich gemacht, um mir das nervige Guisetblabla zu sparen. und wenn ich ein Effekt will das nervige For.

    Ich hoffe man kann die gebrauchen.

    Spoiler anzeigen
    [autoit]


    ;=================================================================================================
    ; Function: _winclose_gfx($w_form,$w_type = "exit", $w_sleep = 10)
    ; Description: Animated Gui Window
    ; Parameter(s): $w_form - The return value from The Gui
    ; $w_type - exit = Exit the Script
    ; delete = Delet the Gui
    ; hide = Hide the Gui
    ; $s_sleep - Sleeptime.
    ; Requirement(s): The $ah_Handle returned from _MemoryOpen.
    ; Return Value(s): On Success - Returns 1
    ; On Failure - Returns -1
    ; @Error - 1 = Param error.
    ; Author(s): Mario2323
    ;=================================================================================================

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

    Func _winclose_gfx($w_form,$w_type = "exit", $w_sleep = 10)
    GUISetState(@SW_DISABLE,$w_form)
    for $i = 255 to 0 step -1
    WinSetTrans($w_form,"",$i)
    sleep($w_sleep)
    Next
    if $w_type = "exit" Then
    Exit
    ElseIf $w_type = "hide" Then
    GUISetState(@SW_HIDE,$w_form)
    ElseIf $w_type = "delete" Then
    GUIDelete($w_form)
    Else
    SetError(1)
    Return -1
    EndIf
    Return 1
    EndFunc
    ;=================================================================================================
    ; Function: _winopen_gfx($w_form, $w_sleep = 10)
    ; Description: Animated Gui Window
    ; Parameter(s): $w_form - The return value from The Gui
    ; $s_sleep - Sleeptime.
    ; Author(s): Mario2323
    ;=================================================================================================

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

    Func _winopen_gfx($w_form, $w_sleep = 10)
    WinSetTrans($w_form,"",0)
    GUISetState(@SW_SHOW,$w_form)
    for $i = 0 to 255 step 1
    WinSetTrans($w_form,"",$i)
    sleep($w_sleep)
    Next

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

    Return 1
    EndFunc

    [/autoit]

    Mario2323

  • Da 10ms der kleinste Sleep ist und mir dabei die Füsse eingeschlafen sind bis das Fenster vollständig sichtbar war, hab ich den Parameter etwas abgeändert und ein einfaches Beispiel hinzugefügt.
    Ansonsten ist das eine ganz nützliche Funktion. :thumbup:

    Spoiler anzeigen
    [autoit]

    $hGui = GUICreate("Test")
    _winopen_gfx($hGui, 5)

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

    Do
    Sleep(10)
    Until GUIGetMsg() = -3

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

    _winclose_gfx($hGui, 'exit', 5)

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

    ;=================================================================================================
    ; Function: _winclose_gfx($w_form,$w_type = "exit", $w_sleep = 10)
    ; Description: Animated Gui Window
    ; Parameter(s): $w_form - The return value from The Gui
    ; $w_type - exit = Exit the Script
    ; delete = Delet the Gui
    ; hide = Hide the Gui
    ; $iStep - Speed
    ; Requirement(s): The $ah_Handle returned from _MemoryOpen.
    ; Return Value(s): On Success - Returns 1
    ; On Failure - Returns -1
    ; @Error - 1 = Param error.
    ; Author(s): Mario2323
    ;=================================================================================================

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

    Func _winclose_gfx($w_form, $w_type = "exit", $iStep = 10)
    GUISetState(@SW_DISABLE, $w_form)
    For $i = 255 To 0 Step - $iStep
    WinSetTrans($w_form, "", $i)
    Sleep(10)
    Next
    If $w_type = "exit" Then
    Exit
    ElseIf $w_type = "hide" Then
    GUISetState(@SW_HIDE, $w_form)
    ElseIf $w_type = "delete" Then
    GUIDelete($w_form)
    Else
    SetError(1)
    Return -1
    EndIf
    Return 1
    EndFunc ;==>_winclose_gfx
    ;=================================================================================================
    ; Function: _winopen_gfx($w_form, $w_sleep = 10)
    ; Description: Animated Gui Window
    ; Parameter(s): $w_form - The return value from The Gui
    ; $iStep - Speed.
    ; Author(s): Mario2323
    ;=================================================================================================

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

    Func _winopen_gfx($w_form, $iStep = 10)
    WinSetTrans($w_form, "", 0)
    GUISetState(@SW_SHOW, $w_form)
    For $i = 0 To 255 Step $iStep
    WinSetTrans($w_form, "", $i)
    Sleep(10)
    Next

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

    Return 1
    EndFunc ;==>_winopen_gfx

    [/autoit]
  • naja die parameter sind ja eigentlich frei wählbar.

    Aber ich finde es bequem, wenn man paar param nicht angeben brauch (schreibfaul XD)

    edit:

    fehler gefunden und ehoben ( sleep muss Sleep($isleep) heißen und nicht sleep(10))

    Spoiler anzeigen
    [autoit]

    $hGui = GUICreate("Test")
    _winopen_gfx($hGui, 5)

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

    Do
    Sleep(10)
    Until GUIGetMsg() = -3

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

    _winclose_gfx($hGui, 'exit', 5)

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

    ;=================================================================================================
    ; Function: _winclose_gfx($w_form,$w_type = "exit", $w_sleep = 10)
    ; Description: Animated Gui Window
    ; Parameter(s): $w_form - The return value from The Gui
    ; $w_type - exit = Exit the Script
    ; delete = Delet the Gui
    ; hide = Hide the Gui
    ; $iStep - Speed
    ; Requirement(s): The $ah_Handle returned from _MemoryOpen.
    ; Return Value(s): On Success - Returns 1
    ; On Failure - Returns -1
    ; @Error - 1 = Param error.
    ; Author(s): Mario2323
    ;=================================================================================================

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

    Func _winclose_gfx($w_form, $w_type = "exit", $iStep = 10)
    GUISetState(@SW_DISABLE, $w_form)
    For $i = 255 To 0 Step - $iStep
    WinSetTrans($w_form, "", $i)
    Sleep($iStep)
    Next
    If $w_type = "exit" Then
    Exit
    ElseIf $w_type = "hide" Then
    GUISetState(@SW_HIDE, $w_form)
    ElseIf $w_type = "delete" Then
    GUIDelete($w_form)
    Else
    SetError(1)
    Return -1
    EndIf
    Return 1
    EndFunc ;==>_winclose_gfx
    ;=================================================================================================
    ; Function: _winopen_gfx($w_form, $w_sleep = 10)
    ; Description: Animated Gui Window
    ; Parameter(s): $w_form - The return value from The Gui
    ; $iStep - Speed.
    ; Author(s): Mario2323
    ;=================================================================================================

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

    Func _winopen_gfx($w_form, $iStep = 10)
    WinSetTrans($w_form, "", 0)
    GUISetState(@SW_SHOW, $w_form)
    For $i = 0 To 255 Step $iStep
    WinSetTrans($w_form, "", $i)
    Sleep($iStep)
    Next

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

    Return 1
    EndFunc ;==>_winopen_gfx

    [/autoit]