Page 1 sur 1

[R] GuiCtrlSetData une image.

Posté : mar. 22 déc. 2009 13:33
par mangaskiff
Bon voilà j'ai fais ce bout de code pour montrer mon problème :

Code : Tout sélectionner

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 625, 445, 192, 124)
$Button1 = GUICtrlCreateButton("Changer", 24, 8, 577, 65, $WS_GROUP)
$Pic1 = GUICtrlCreatePic("", 56, 112, 505, 313, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            GUICtrlSetData($Pic1,"C:\Users\xxxxxx\Pictures\image.jpg")
    EndSwitch
WEnd
 
Je veux juste faire un guictrlsetdata sur $Pic1 quand le buttons "changer" est presser .

Merci d'avance !

Re: [..] GuiCtrlSetData une image.

Posté : mar. 22 déc. 2009 14:17
par Tlem
La solution est dans la partie Remarks de l'aide de la fonction GUICtrlCreatePic().

Re: [..] GuiCtrlSetData une image.

Posté : mar. 22 déc. 2009 14:29
par mangaskiff
Merci j'ai trouvé :

Code : Tout sélectionner

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 625, 445, 192, 124)
$Button1 = GUICtrlCreateButton("Changer", 24, 8, 577, 65, $WS_GROUP)
$Pic1 = GUICtrlCreatePic("", 56, 112, 505, 313, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            GUICtrlSetImage($Pic1,"C:\Users\xxxxxx\Pictures\image.jpg")
    EndSwitch
WEnd
 
ENfaite il faut juste remplacer GuCtrlCetData par GUICtrlSetImage.