Hi,
ich möchte das, wenn ich ein Button mit einem Bild anklicke, das sich das Bild in ein anderes ändert und danach wieder zum Ausgangsbild wechselt.
Hier ist mein bisheriger Code den ich mithilfe von Picture als Button animiert geschrieben habe:
[autoit]
#include<WindowsConstants.au3>
#include<GUIConstantsEx.au3>
#include<StaticConstants.au3>
Global $pic = "button.bmp"
$gui = GUICreate("Form1", 257, 121, 192, 124)
$btnPic = GUICtrlCreatePic($pic, 56, 32, 150, 50)
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $btnPic
_AnimButton($gui, $btnPic)
MsgBox(0, '', 'click')
Case $msg = $GUI_EVENT_CLOSE
Exit
EndSelect
WEnd
;==================================================================================================
; Function Name: _AnimButton($IDgui, $IDbtn [, $delay=150])
; Description: animiert ein Pic, wie einen geklickten Button
; Parameter(s): $IDgui ID der GUI
; $IDbtn ID des Picture als Button
; optional $delay Verzögerung Zustand geklickt/nicht geklickt, Standard 150 ms
;==================================================================================================
Func _AnimButton($IDgui, $IDbtn, $delay=150)
Local $pos = ControlGetPos($IDgui, '', $IDbtn)
Local $pWin = WinGetPos($IDgui)
ControlMove($IDgui, '', $IDbtn, $pos[0], $pos[1]+1, $pos[2]-1, $pos[3]-1)
Local $tmpGui = GUICreate('', $pos[2], $pos[3], $pWin[0]+$pos[0], $pWin[1]+$pos[1]+20, $WS_POPUP)
WinSetTrans($tmpGui, '', 120)
GUISetState(@SW_SHOW, $tmpGui)
Sleep($delay)
GUIDelete($tmpGui)
ControlMove($IDgui, '', $IDbtn, $pos[0], $pos[1], $pos[2], $pos[3])
EndFunc ;==> _AnimButton
Also anstatt, das das eine Fenster transparent wird, soll ein neues Bild erstellt werden.
Hoffe ihr wisst was ich meine ![]()
MfG
Bladerunner85