pipobona Posted November 20, 2005 Posted November 20, 2005 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
BigDod Posted November 20, 2005 Posted November 20, 2005 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
pipobona Posted November 20, 2005 Author Posted November 20, 2005 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?
Valuater Posted November 20, 2005 Posted November 20, 2005 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)
pipobona Posted November 21, 2005 Author Posted November 21, 2005 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now