Rollover Bilder

  • Hallo Leute!
    Habe 2 Fragen:

    1. Rolloverbilder
    Jeder kennt es und jeder hat mit dem schon mal etwas zu tun gehabt. Rolloverbilder.
    Dh: Wenn man die Maus über ein Bild bewegt, dass das Bild hervorsticht.

    Jetzt habe ich eine Frage, ob man es mit Autoit in einer Gui auch so machen kann.
    Ich dachte da an GUIGetCursorInfo und $GUI_EVENT_MOUSEMOVE nur leider krieg ich das nicht gebacken :(

    wollte mal fragen, ob sich vl jemand findet und mir helfen könnte, indem er mir ein Beispielsscript schickt :D

    Wäre nett. Danke

    2.GUIGetMsg
    Meine 2te Frage scheint recht simpel zu sein.

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <SliderConstants.au3>
    #include <WindowsConstants.au3>
    $Form1 = GUICreate("Test", 196, 65, 192, 124)
    $Slider1 = GUICtrlCreateSlider(16, 16, 161, 25)
    GUISetState(@SW_SHOW)

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

    Func Test ()
    MsgBox (0 ,"" ,"Test")
    EndFunc

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

    While 1
    $msg = GUIGetMsg(1)
    Switch $nMsg
    Case $msg[0] = $GUI_EVENT_CLOSE
    Exit
    Case $msg[0] = $Slider1
    _Test ()
    EndSwitch
    WEnd

    [/autoit]

    und zwar wollte ich eine msgbox erscheinen lassen, sobald ich auf den Slider klicke
    jedoch erscheint die msgbox erst, nachdem ich losgelassen habe
    Wie kann ich das ändern :(? Bin schon am verzweifeln

    Danke im Vorraus

    mfg XXlolimanxx

    Einmal editiert, zuletzt von XXlolimanxx (6. Juli 2010 um 17:26)

  • Hallo XXlolimanxx,

    zu 1.: hier ein Beispiel das du zu deinem Zweck umbauen kannst:

    Spoiler anzeigen
    [autoit]

    #include<WindowsConstants.au3>
    #include<GUIConstantsEx.au3>
    #include<StaticConstants.au3>

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

    Global $pic = @SystemDir & '\oobe\images\nextover.jpg'
    Global $pic2 = @SystemDir & '\oobe\images\nextdown.jpg'

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

    $gui = GUICreate("Test", Default, Default, -1, -1)
    $btnPic = GUICtrlCreatePic($pic, 30, 40, 24, 24,$SS_NOTIFY)
    $btnPic2 = GUICtrlCreateButton("OK",-100,-100,1,1)
    GUICtrlSetState($btnPic2,$GUI_FOCUS)
    GUISetState()

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

    While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $btnPic
    If _AnimButton($gui, $btnPic) Then MsgBox(0, '', 'click Pic')
    GUICtrlSetState($btnPic2,$GUI_FOCUS)
    Case $msg = $btnPic2
    _AnimButton($gui, $btnPic)
    MsgBox(0, '', 'auch ein click')
    Case $msg = $GUI_EVENT_CLOSE
    Exit
    EndSelect
    WEnd

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

    ;==================================================================================================
    ; 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
    ;==================================================================================================
    Func _AnimButton($IDgui, $IDbtn)
    Local $pos = ControlGetPos($IDgui, '', $IDbtn)
    Local $pWin = WinGetPos(GUICtrlGetHandle($IDbtn))
    ControlMove($IDgui, '', $IDbtn, $pos[0], $pos[1] + 1, $pos[2] - 1, $pos[3] - 1)
    Sleep(10)
    ControlMove($IDgui, '', $IDbtn, $pos[0], $pos[1] + 2, $pos[2] - 2, $pos[3] - 2)
    Sleep(10)
    ControlMove($IDgui, '', $IDbtn, $pos[0], $pos[1] + 3, $pos[2] - 3, $pos[3] - 3)
    GUICtrlSetImage($IDbtn, $pic2)
    ;Local $tmpGui = GUICreate('', $pos[2], $pos[3], $pWin[0], $pWin[1], $WS_POPUP, $WS_EX_TOOLWINDOW)
    ;WinSetTrans($tmpGui, '', 120)
    ;GUISetState(@SW_SHOWNOACTIVATE, $tmpGui)
    $return = 1
    Do
    $x = GUIGetCursorInfo($IDgui)
    If $x[4] <> $IDbtn Then $return = 0
    Sleep(10)
    Until $x[2] = 0
    ;GUIDelete($tmpGui)
    ControlMove($IDgui, '', $IDbtn, $pos[0], $pos[1] + 2, $pos[2] - 2, $pos[3] - 2)
    Sleep(10)
    ControlMove($IDgui, '', $IDbtn, $pos[0], $pos[1] + 1, $pos[2] - 1, $pos[3] - 1)
    Sleep(10)
    ControlMove($IDgui, '', $IDbtn, $pos[0], $pos[1], $pos[2], $pos[3])
    GUICtrlSetImage($IDbtn, $pic)
    Return $return
    EndFunc ;==>_AnimButton

    [/autoit]

    ist AFAIR von BugFix

    zu 2.: mach es doch so:

    Spoiler anzeigen
    [autoit]

    >#include <GUIConstantsEx.au3>
    #include <SliderConstants.au3>
    #include <WindowsConstants.au3>
    $Form1 = GUICreate("Test", 196, 65, 192, 124)
    $Slider1 = GUICtrlCreateSlider(16, 16, 161, 25)
    GUICtrlSetData(-1,50)
    $iOldSlider = 50
    $Label = GUICtrlCreateLabel("50",16,50,160)
    GUISetState(@SW_SHOW)

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

    While 1
    $iSlider = GUICtrlRead($Slider1)
    if $iSlider <> $iOldSlider Then
    Test($iSlider)
    $iOldSlider = $iSlider
    EndIf
    $nmsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    EndSwitch
    WEnd

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

    Func Test ($iPos)
    GUICtrlSetData($Label,$iPos) ;nervt nicht so wie eine MsgBox
    EndFunc

    [/autoit]

    mfg (Auto)Bert