Jump to content

Recommended Posts

Posted

Greetings,

How do I get both the text and an icon on a button?

$button1 = GUICtrlCreateButton ("Test", 0,0,100,100,$BS_TOP + $BS_ICON)
GUICtrlSetImage (-1, "C:\Games\Archery.exe",0)

Thanks,

-Garrett

Posted

You could always create an icon with both text and image in it.


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

Posted (edited)

I think it would be easier to create a bitmap with an icon and text on it.

Use the $BS_BITMAP style instead of the $BS_ICON style that's in your example.

You can always use MS Paint for the bitmap and extract the icon from archery.exe using an icon browsing program (search the forums).

edit: beta is not needed

Edited by syberschmo
  • 1 year later...
Posted

Autoit Wrappers is your friend

; Icon on Button - (made easy)
; Author - Valuater

#include <GUIConstants.au3>

$mywin = GUICreate("my gui")
$btn1 = IconButton("Help", 30, 30, 70, 32, 23)
GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $btn1 Then MsgBox(0,0,"You pressed the Icon Button  ", 2)
    If $msg = $GUI_EVENT_CLOSE Then Exit
WEnd

Func IconButton($BItext, $BIleft, $BItop, $BIwidth, $BIheight, $BIconNum, $BIDLL = "shell32.dll")
    GUICtrlCreateIcon($BIDLL, $BIconNum, $BIleft + 5, $BItop + (($BIheight - 16) / 2), 16, 16)
    GUICtrlSetState( -1, $GUI_DISABLE)
    $XS_btnx = GUICtrlCreateButton($BItext, $BIleft, $BItop, $BIwidth, $BIheight, $WS_CLIPSIBLINGS)
    Return $XS_btnx
EndFunc

8)

NEWHeader1.png

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...