Jump to content

Hover a picture when mouse over


Onylove
 Share

Recommended Posts

Link to comment
Share on other sites

Another example.

And for those who quenched their thirst on Yashied's link, I added the _Iif one-liner to make the script look a little bit more complicated.

;
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <Misc.au3>

Local $Msg, $GUI, $Pic1, $Pic2

$GUI = GUICreate("My GUI picture", 350, 300, -1, -1, $WS_SIZEBOX + $WS_SYSMENU)
GUISetBkColor(0xE0FFFF)

$Pic1 = GUICtrlCreatePic(@SystemDir & "\oobe\images\mslogo.jpg", 50, 50, 169, 68)
GUICtrlSetState($Pic1, $GUI_SHOW)

$Pic2 = GUICtrlCreatePic("C:\Program Files\AutoIt3\Examples\GUI\logo4.gif", 50, 50, 169, 68)
GUICtrlSetState($Pic2, $GUI_SHOW)

GUISetState()

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_MOUSEMOVE
            $aCursor = GUIGetCursorInfo()

            GUICtrlSetState($Pic2, _Iif(($aCursor[4] = $Pic2) And BitAND(GUICtrlGetState($Pic2), 16), $GUI_HIDE, _Iif($aCursor[4] <> $Pic1 And BitAND(GUICtrlGetState($Pic2), 32), $GUI_SHOW, 0)))
            ; The above one liner is the same (has same logic structure and does the same) as the below, commented out If - ElseIf - EndIf lines.

            #cs
            If ($aCursor[4] = $Pic2) And BitAND(GUICtrlGetState($Pic2), 16) Then
                GUICtrlSetState($Pic2, $GUI_HIDE)
            ElseIf $aCursor[4] <> $Pic1 And BitAND(GUICtrlGetState($Pic2), 32) Then
                GUICtrlSetState($Pic2, $GUI_SHOW)
            EndIf
            #ce

        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd
;
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...