Jump to content
Sign in to follow this  

Hover a picture when mouse over

Recommended Posts


Share this post

Link to post
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)

$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)


While 1
    $Msg = GUIGetMsg()
    Switch $Msg
            $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.

            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)

        Case $GUI_EVENT_CLOSE

Share this post

Link to post
Share on other sites

That is a neat trick Malkey. For me it really adds to the complexity of the script and I probably would defer to a function call instead. Certainly nice to know about in case I one day am at your skill level.

Share this post

Link to post
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
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.