Jump to content

Recommended Posts

Posted

If it needen't look like a Button with a pushed state, just add $SS_NOTIFY in the normal Style

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Posted

Well If: GUICtrlCreatePic() Is what you want, then you can use hover udf, to change it's appearance like a button.

Posted (edited)

is there a way to put an image in your gui as a button?

I was just trying to do the same thing. Make a 100x100 pixel image call a function when clicked.

$Button = GUICtrlCreateButton ("", 10,-1,100,100,$BS_BITMAP)
GUICtrlSetImage(-1,"Path\image.bmp")oÝ÷ ØÆ¤zƺÛh­©â¨¢{h¦âµ»­×åÉÊ'µ¨§nj_W¬jëh×6$Button = GUICtrlCreateButton ("", 10,-1,100,100,$BS_ICON)
GUICtrlSetImage(-1,"Path\icon.ico")

Does the same, but only accepts *.ico and libraries containing them.

I am still trying to find a way to make clicking a jpg call a function, but it might not be possible.

Edit:

But then the $SS_NOTIFY seems pretty much exactly what I need. :D I make stuff way to complicated some times.

Adding a different cursor style on mouseover will make it more intuitive in use aswell.

Edited by Tvern
Posted

#include <GUIConstants.au3>

GUICreate("Image button", 95, 55)
$Button = GUICtrlCreateButton("", 10, 10, 75, 35, $BS_ICON)
GUICtrlSetImage(-1, "shell32.dll", 10)

GUISetState()

While 1
    $iMsg = GUIGetMsg()
    Switch $iMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button
            MsgBox(0, "", "You clicked the icon button!")
    EndSwitch
WEnd

Posted

#include <GUIConstants.au3>
 
 GUICreate("Image button", 95, 55)
 $Button = GUICtrlCreateButton("", 10, 10, 75, 35, $BS_ICON)
 GUICtrlSetImage(-1, "shell32.dll", 10)
 
 GUISetState()
 
 While 1
     $iMsg = GUIGetMsg()
     Switch $iMsg
         Case $GUI_EVENT_CLOSE
             Exit
         Case $Button
             MsgBox(0, "", "You clicked the icon button!")
     EndSwitch
 WEnd
Maybe, you can try reading this again

...

$Button = GUICtrlCreateButton ("", 10,-1,100,100,$BS_ICON)
GUICtrlSetImage(-1,"Path\icon.ico")

Does the same, but only accepts *.ico and libraries containing them.

I am still trying to find a way to make clicking a jpg call a function, but it might not be possible.

8

NEWHeader1.png

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
×
×
  • Create New...