Bonjour , j'ai chercher sur internet j'ai lu plusieurs sujet qui ne m'ont points aidé .
Alors je m'en remet a vous .
J'ai plusieurs bouton sur mon Gui je veux simplement remplacer le skin des boutons via des images mais y'a toujours un bug .
https://gyazo.com/a2fb619e2e65c12d45ca40958226982f
Par exemple l'image Grosbouton je veux l'utiliser pour un bouton de base c'est un bouton arrondi sur les coté mais quand je le met l'image sur mon bouton le bouton prend la couleur de l'image mais reste rectangulaire ( J'ai bien mis exactement les même dimension images/bouton ) . J'ai voulu aussi transformer un bouton en logo de discord le bouton change aucunement il reste gris https://gyazo.com/f35c2fd9f4d74af36f4141335296729c
Images pour les boutons
Règles du forum
- Merci de consulter la section "Règles du forum" et plus particulièrement "Règles et Mentions Légales du site autoitscript.fr" avant d'écrire un message.
- walkson
- Modérateur
- Messages : 1020
- Enregistré le : ven. 12 août 2011 19:49
- Localisation : Hurepoix
- Status : Hors ligne
Re: Images pour les boutons
Bonjour,
On peut mettre directement un BMP, un IC0 sur un bouton mais pas un PNG
Voici un code qui le permet
Merci de télécharger sur le forum vos images (comme j'ai fait) pour pouvoir être consulter sans se perdre
On peut mettre directement un BMP, un IC0 sur un bouton mais pas un PNG
Voici un code qui le permet
#include <GDIplus.au3>
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
_GDIPlus_Startup()
Global $hHBitmap_1 = _GDIPlus_BitmapCreateFromFile("C:\Users\PC\Pictures\Open Office1.png") ;image en 72x72
$hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hHBitmap_1)
_GDIPlus_BitmapDispose($hHBitmap_1)
Global $hGUI = GUICreate("", 300, 200)
GUISetBkColor(0xFFFFFF)
Global $iBtn = GUICtrlCreateButton("", (300 - 72) / 2, (200 - 72) / 2, 72, 72, $BS_BITMAP), $hBtn = GUICtrlGetHandle($iBtn)
_WinAPI_DeleteObject(_SendMessage($hBtn, $BM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap))
GUISetState()
Do
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
_WinAPI_DeleteObject($hHBitmap)
_GDIPlus_Shutdown()
GUIDelete()
Exit
Case $iBtn
MsgBox(0, "Info", "Image PNG in button was downloaded ")
EndSwitch
Until False
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
_GDIPlus_Startup()
Global $hHBitmap_1 = _GDIPlus_BitmapCreateFromFile("C:\Users\PC\Pictures\Open Office1.png") ;image en 72x72
$hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hHBitmap_1)
_GDIPlus_BitmapDispose($hHBitmap_1)
Global $hGUI = GUICreate("", 300, 200)
GUISetBkColor(0xFFFFFF)
Global $iBtn = GUICtrlCreateButton("", (300 - 72) / 2, (200 - 72) / 2, 72, 72, $BS_BITMAP), $hBtn = GUICtrlGetHandle($iBtn)
_WinAPI_DeleteObject(_SendMessage($hBtn, $BM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap))
GUISetState()
Do
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
_WinAPI_DeleteObject($hHBitmap)
_GDIPlus_Shutdown()
GUIDelete()
Exit
Case $iBtn
MsgBox(0, "Info", "Image PNG in button was downloaded ")
EndSwitch
Until False
- Fichiers joints
-
- Open Office1.png (8.07 Kio) Vu 4519 fois
Cordialement,
Walkson
"Horas non numero nisi serenas " Le canon de midi
(Je ne compte que les heures heureuses)
Walkson
"Horas non numero nisi serenas " Le canon de midi
(Je ne compte que les heures heureuses)
- walkson
- Modérateur
- Messages : 1020
- Enregistré le : ven. 12 août 2011 19:49
- Localisation : Hurepoix
- Status : Hors ligne
Re: Images pour les boutons
Et si vous voulez uniquement avoir une image comme (un pseudo) bouton, on peut le faire comme ceci
_GDIPlus_Startup()
Global $hHBitmap_1 = _GDIPlus_BitmapCreateFromFile("C:\Users\PC\Pictures\Open Office1.png") ;image en 72x72
$hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hHBitmap_1)
_GDIPlus_BitmapDispose($hHBitmap_1)
Global $hGUI = GUICreate("", 300, 200)
Global $iBtn = GUICtrlCreateLabel("", (300 - 72) / 2, (200 - 72) / 2, 72, 72, $SS_BITMAP), $hBtn = GUICtrlGetHandle($iBtn)
GUICtrlSetCursor(-1,0)
_WinAPI_DeleteObject(_SendMessage($hBtn, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap))
GUISetState()
Do
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
_WinAPI_DeleteObject($hHBitmap)
_GDIPlus_Shutdown()
GUIDelete()
Exit
Case $iBtn
MsgBox(0, "Info", "Image PNG in button was downloaded from disk !")
EndSwitch
Until False
Global $hHBitmap_1 = _GDIPlus_BitmapCreateFromFile("C:\Users\PC\Pictures\Open Office1.png") ;image en 72x72
$hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hHBitmap_1)
_GDIPlus_BitmapDispose($hHBitmap_1)
Global $hGUI = GUICreate("", 300, 200)
Global $iBtn = GUICtrlCreateLabel("", (300 - 72) / 2, (200 - 72) / 2, 72, 72, $SS_BITMAP), $hBtn = GUICtrlGetHandle($iBtn)
GUICtrlSetCursor(-1,0)
_WinAPI_DeleteObject(_SendMessage($hBtn, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap))
GUISetState()
Do
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
_WinAPI_DeleteObject($hHBitmap)
_GDIPlus_Shutdown()
GUIDelete()
Exit
Case $iBtn
MsgBox(0, "Info", "Image PNG in button was downloaded from disk !")
EndSwitch
Until False
- Fichiers joints
-
- image avec transparence
- Open Office1.png (7.07 Kio) Vu 4501 fois
Cordialement,
Walkson
"Horas non numero nisi serenas " Le canon de midi
(Je ne compte que les heures heureuses)
Walkson
"Horas non numero nisi serenas " Le canon de midi
(Je ne compte que les heures heureuses)