Comment afficherune image dans un ScrollAreaGadget

Vous débutez et vous avez besoin d'aide ? N'hésitez pas à poser vos questions
patmaba
Messages : 15
Inscription : mar. 02/mars/2004 7:40
Localisation : belgique

Comment afficherune image dans un ScrollAreaGadget

Message par patmaba »

Bonjour,

Je suis nouveau :) et j'ai qq difficulté.

mon problème est le suivant
J'ai une image dans une scrollarea.
Quand j'appuie sur les scrollbar, l'image ne suit pas le défillement.
Voici mon code:

Si qq peut m'aider.
merci

Code : Tout sélectionner

; Enable all the decoders than PureBasic actually supports
;
UseJPEGImageDecoder()
; Enable all the encoders than PureBasic actually supports
;
UseJPEGImageEncoder()

If 
OpenWindow(0,0,0,305,140,#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget,"ImageGadget") 
And CreateGadgetList(WindowID(0))
    If LoadImage(0, "photo.jpg")    ; change 2nd parameter to the 
path/filename of your image
      ScrollAreaGadget(0, 10, 10,290,120, 375, 155, 30)
      ImageGadget(0, 10,10,100,83,UseImage(0))                      ; 
imagegadget standard
      ImageGadget(1,130,10,100,83,UseImage(0),#PB_Image_Border)     ; 
imagegadget with border
      CloseGadgetList()
    EndIf
    Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf
brossden
Messages : 818
Inscription : lun. 26/janv./2004 14:37

Message par brossden »

Bonjour Patmaba

Si je peux te donner un conseil, évite de faire des syntaxes trop longues, c'est plus difficile à débugger et cela n'apporte pas grand chose !

Je pense que ton problème vient de la syntaxe :
ScrollAreaGadget(0, 10, 10,290,120, xxx, yyy, ddd)
xxx doit être égal au nombre de pixel en largeur de ta photo !
yyy doit être égal au nombre de pixel en hauteur de ta photo !
ddd quand à lui doit être choisi pour en fonction de la précision du déplacement des scroll !

Je me suis permis de modifier tes lignes de code !
les valeurs de xxx... correspondent à ma photo !

Code : Tout sélectionner

; Enable all the decoders than PureBasic actually supports 
; 
UseJPEGImageDecoder() 
; Enable all the encoders than PureBasic actually supports 
; 
UseJPEGImageEncoder() 

If  OpenWindow(0,0,0,305,140,#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget,"ImageGadget")  
  If CreateGadgetList(WindowID(0)) 
    If LoadImage(0, "c:\photo.jpg")    
      ; change 2nd parameter to the path/filename of your image 
      ScrollAreaGadget(0, 10, 10,290,120, 2560, 1920, 300) 
      ImageGadget(0, 10,10,100,83,UseImage(0))                      
      ;  imagegadget standard 
      ImageGadget(1,130,10,100,83,UseImage(0),#PB_Image_Border)     
      ;  imagegadget with border 
      CloseGadgetList() 
    EndIf 
    
    Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow 
  EndIf 
EndIf
Bonne Journée
Denis
patmaba
Messages : 15
Inscription : mar. 02/mars/2004 7:40
Localisation : belgique

Message par patmaba »

ok c'est çà, merci beaucoup
Répondre