Jump to content

GUICtrlSetImage on Button control


Recommended Posts

Hi.. am I dumb? Is it even possible to skin a button with a picture ? I can't get this to work... anyone could check what's wrong in this please :

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)
GUICreate("", 300, 300)
GUISetState()
GUISetOnEvent($GUI_EVENT_CLOSE, "quit")

$bttn = GUICtrlCreateButton("damn", 10, 10, 60, 40)
GUICtrlSetImage($bttn, "bttn.png")

While 1
    Sleep(200)
WEnd

Func quit()
    Exit
EndFunc

Thanks ! (I tried with png..gif..jpg..bmp.. I tried putting the full path.. no result :) )

Edited by MikeP
Link to comment
Share on other sites

  • Moderators

Icon or Bitmap.

The style must be set to $BS_ICON or $BS_BITMAP respectively.

Edit:

You may want to look at XSkin in the example forum for "skinning" options.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Maybe...

#include <GUIConstantsEx.au3>

Opt("GUIOnEventMode", 1)
GUICreate("", 300, 300)
GUISetState()
GUISetOnEvent($GUI_EVENT_CLOSE, "quit")

$bttn = GUICtrlCreatePic("C:\Location to picture.jpg", 10, 10, 60, 40)
;GUICtrlSetImage($bttn, "bttn.png"); use this to change the picture

While 1
    Sleep(200)
WEnd

Func quit()
    Exit
EndFunc   ;==>quit

... and for a set of buttons with skins

http://www.autoitscript.com/forum/index.ph...st&p=307380

8)

NEWHeader1.png

Link to comment
Share on other sites

Yeah ..thanks I just found it too

Anyway that's not so bad I asked you since now I'll have a look at XSkin :)

Ty Valuater.. I guess I'll do that since putting a bmp on a button like this doesn't give a good result..I'll rather use a picture as a button good idea

Edited by MikeP
Link to comment
Share on other sites

change

$bttn = GUICtrlCreateButton("damn", 10, 10, 60, 40)

to

$bttn = GUICtrlCreateButton("damn", 10, 10, 60, 40, $BS_BITMAP)

then use a bmp image.

If using the beta version of AutoIt, #include <ButtonConstants.au3>

edit: lol way too slow

Edited by theguy0000

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

Yeah ..thanks I just found it too

Anyway that's not so bad I asked you since now I'll have a look at XSkin :)

Ty Valuater.. I guess I'll do that since putting a bmp on a button like this doesn't give a good result..I'll rather use a picture as a button good idea

Be sure to see EzSkin too!

( the link above )

8)

NEWHeader1.png

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