Page 1 sur 1

[R] GUICtrlCreateButton et icone

Posté : ven. 07 sept. 2007 14:30
par Vins83
hello

Voilà une question bien bete,mais je ne trouve pas la solution..

Je veux mettre une icone dans mon boutton,mais avec un texte,mais apparement cela ne se fait pas..

Code : Tout sélectionner

$BS_ICON
Quelqu'un a t'il une idée?

Merci

@+ Vins

Posté : ven. 07 sept. 2007 20:57
par johnp
voila une solution trouvée sur le fofo anglais

http://www.autoitscript.com/forum/index ... ntry243265

Code : Tout sélectionner

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

#include <GUIConstants>

$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
 

Posté : dim. 09 sept. 2007 14:00
par Vins83
Un grand merci pour votre réponse.

@+ Vins