Jump to content

Click-Able Pictures


ZanaxNL
 Share

Recommended Posts

Hey, I need to have clickable Pictures.

i found this :

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $msg
    
    GUICreate("My GUI")  ; will create a dialog box that when displayed is centered

    GUICtrlCreateButton("my picture button", 10, 20, 40, 40, $BS_ICON)
    GUICtrlSetImage(-1,"shell32.dll",22)
    
    GUISetState()

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc   ;==>Example

But how to get a other picture then shell32.dll > 22 ?

When i try other picture it does't show up.

Thanks,

Zanax

Link to comment
Share on other sites

This is an example of some click-able pictures.

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $msg, $But1, $But2, $But3

    GUICreate("My GUI") ; will create a dialog box that when displayed is centered

    $But1 = GUICtrlCreateButton("my picture button", 10, 20, 40, 40, $BS_ICON)
    GUICtrlSetImage(-1, "shell32.dll", 22)

    ; Supported types BMP, JPG, GIF(but not animated).
    $But2 = GUICtrlCreatePic(RegRead("HKLM\SOFTWARE\AutoIt v3\AutoIt", "InstallDir") & _
            "\Examples\GUI\mslogo.jpg", 10, 65, 200, 40, -1, BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE))

    $But3 = GUICtrlCreateButton("", 10, 110, 40, 40, $BS_BITMAP)
    GUICtrlSetImage(-1, RegRead("HKLM\SOFTWARE\AutoIt v3\AutoIt", "InstallDir") & _
            "\Examples\GUI\Advanced\Images\Blue.bmp")

    GUISetState()

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        Switch $msg
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $But1
                MsgBox(0, "", " Button 1 pressed", 1)
            Case $But2
                GUICtrlSetStyle($But2, -1, $WS_EX_STATICEDGE)
                Do
                    Sleep(10)
                Until Not _IsPressed('01') ; Until left mouse button is released.
                GUICtrlSetStyle($But2, -1, BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE))
                MsgBox(0, "", " Button 2 pressed", 1)
            Case $But3
                MsgBox(0, "", " Button 3 pressed", 1)
        EndSwitch
    WEnd
EndFunc ;==>Example
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...