Sign in to follow this  
Followers 0
pipobona

Buttons displaying a .jpg image

5 posts in this topic

Hi all,

I got another question , I think it's often asked but I can't find the solution with search.

How Can you put a .jpg image on a button?

I know how to do the icon thingey but it has to be possible with images too.

This is what I got and it doesn't work:

....
Dim $count = 1
While $count < 81
    
    $tilex[$count] = IniRead ( "maps/start.ini", "tile"&$count,"x","ERROR" )
    $tiley[$count] = IniRead ( "maps/start.ini", "tile"&$count,"y","ERROR" )
    $layer0button[$count] = GUICtrlCreateButton("",$tilex[$count],$tiley[$count], 40,40,$BS_BITMAP)
    GuiCtrlSetImage($layer0button[$count],"tiles/zwart.jpg")
    $count = $count + 1
Wend 
....

the image is also 40x40 size

Share this post


Link to post
Share on other sites



Convert your jpg to a bmp and it should work. I do not know if it is possible to do with a jpg.



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Convert your jpg to a bmp and it should work. I do not know if it is possible to do with a jpg.

but that would use too much room, because I have 80 buttons with 80 different pictures, isn't there any other way?

Share this post


Link to post
Share on other sites

maybe like this

#include <GUIConstants.au3>
GUICreate("My GUI picture",350,300,-1,-1) ; will create a dialog box that when displayed is centered

GUISetBkColor (0xE0FFFF)
$n=GUICtrlCreatePic(@Systemdir & "\oobe\images\mslogo.jpg",50,50, 200,50 )

GUISetState ()

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    
    If $msg = $n Then
        MsgBox(0,"pic button", "you pressed the pic button")
    EndIf
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

maybe like this

#include <GUIConstants.au3>
GUICreate("My GUI picture",350,300,-1,-1); will create a dialog box that when displayed is centered

GUISetBkColor (0xE0FFFF)
$n=GUICtrlCreatePic(@Systemdir & "\oobe\images\mslogo.jpg",50,50, 200,50 )

GUISetState ()

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    
    If $msg = $n Then
        MsgBox(0,"pic button", "you pressed the pic button")
    EndIf
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

8)

nice , that works I tried that before but I think I made up something wrong that's why it didn't work.

Thanks B)

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