Jump to content

Buttons displaying a .jpg image


pipobona
 Share

Recommended Posts

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

Link to comment
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.


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

Link to comment
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

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

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...