Sign in to follow this  
Followers 0
ludocus

image as button?

10 posts in this topic

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

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#4 ·  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

Share this post


Link to post
Share on other sites

#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

Share this post


Link to post
Share on other sites

#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

Share this post


Link to post
Share on other sites

thnx everybody :D

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  
Followers 0