Page 2 sur 2

Publié : jeu. 30/nov./2006 0:01
par Backup
par contre ce code fonctionne :D



Code : Tout sélectionner

; English forum: http://purebasic.myforums.net/viewtopic.php?t=6534&highlight=
; Author: Num3
; Date: 12. June 2003

; Note: coloring doesn't work with enabled XP-Skin support!

Declare Open_Window_0() 

;- Window Constants 
; 
#Window_0  = 0 
#PBM_SETBARCOLOR = $409 
#PBM_SETBKCOLOR = $2001 
;- Gadget Constants 
; 
#Gadget_0  = 0 


Procedure Open_Window_0() 
  If OpenWindow(#Window_0, 251, 249, 300, 100, "Colored Progress Bar",#PB_Window_SystemMenu  | #PB_Window_SizeGadget  | #PB_Window_TitleBar ) 
    If CreateGadgetList(WindowID(#Window_0)) 
      ProgressBarGadget(#Gadget_0, 10, 10, 190, 10, 0, 100 ,#PB_ProgressBar_Smooth)        
      PostMessage_(GadgetID(#Gadget_0), #PBM_SETBARCOLOR, 0, RGB(255, 204, 51)) 
      PostMessage_(GadgetID(#Gadget_0), #PBM_SETBKCOLOR, 0, RGB(51, 102, 153)) 
      SetGadgetState(#Gadget_0,80)  
      
    EndIf 
  EndIf 
EndProcedure 


Open_Window_0() 
Repeat 
  Event  = WaitWindowEvent() 
  
  
Until Event  = #PB_Event_CloseWindow
; ExecutableFormat=Windows
; FirstLine=1
; EOF

Publié : jeu. 30/nov./2006 0:07
par Flype
mais l'autre aussi fonctionne :roll: faut juste changer les couleurs.

et comme çà tu vois quelque chose ?

Code : Tout sélectionner

#PBM_SETBKCOLOR = $2001
#PBM_SETBARCOLOR = $409

If OpenWindow(0, 0, 0, 320, 160, "ProgressBarGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  
  CreateGadgetList(WindowID(0))
  
  ProgressBarGadget(0,  10, 30, 300,  20, 0, 145)
  
  Repeat 
    
    SetGadgetState(0, i) : i + 1
    
    If i > 145
      SendMessage_(GadgetID(0), #PBM_SETBARCOLOR, 0, RGB(Random(255), Random(255), Random(255)))
      SendMessage_(GadgetID(0), #PBM_SETBKCOLOR, 0, RGB(Random(255), Random(255), Random(255)))
      i = 0
    EndIf
    
  Until WaitWindowEvent(1) = #PB_Event_CloseWindow
  
EndIf 
mais bon pas ya pas d'intérêt. on peut le faire avec les commandes purebasic :

Code : Tout sélectionner

If OpenWindow(0, 0, 0, 320, 160, "ProgressBarGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  
  CreateGadgetList(WindowID(0))
  
  ProgressBarGadget(0,  10, 30, 300,  20, 0, 145)
  
  Repeat 
    
    SetGadgetState(0, i) : i + 1
    
    If i > 145
      SetGadgetColor(0, #PB_Gadget_BackColor, RGB(Random(255), Random(255), Random(255)))
      SetGadgetColor(0, #PB_Gadget_FrontColor, RGB(Random(255), Random(255), Random(255)))
      i = 0
    EndIf
    
  Until WaitWindowEvent(1) = #PB_Event_CloseWindow
  
EndIf 
et dans tout les cas - ca ne fonctionne pas si le mode Support des Thèmes XP est activé.

Publié : jeu. 30/nov./2006 0:20
par Backup
Si c'est bon !! mais l'exemple n'etait pas explicite !! :lol:

j'aurai preferé ceci
(Atention ne marche pas avec les themes XP actif !! )

Code : Tout sélectionner

#PBM_SETBKCOLOR = $2001
#PBM_SETBARCOLOR = $409

#gadjet1=0
#gadjet2=1

If OpenWindow(0, 0, 0, 320, 160, "ProgressBarGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    CreateGadgetList(WindowID(0)) 
   
    ProgressBarGadget(0,  10, 30, 300,  20, 0, 145) 
    SendMessage_(GadgetID(#gadjet1), #PBM_SETBARCOLOR, 0, RGB($FF,$0,$FF))
    SendMessage_(GadgetID(#gadjet1), #PBM_SETBKCOLOR, 0, RGB($0,0,$FF)) 
      ProgressBarGadget(1,  10, 90, 250,  30, 0, 145, #PB_ProgressBar_Smooth)
    SendMessage_(GadgetID(#gadjet2), #PBM_SETBARCOLOR, 0, RGB($0,$FF,$FF))
    SendMessage_(GadgetID(#gadjet2), #PBM_SETBKCOLOR, 0, RGB($F2,$F0,$0)) 
EndIf 
    
    
    For lg = 1 To 145
        Delay(2) 
        SetGadgetState(0,lg)
        SetGadgetState(1,lg) 
    Next lg
    Repeat : Until WindowEvent()=#PB_Event_CloseWindow


Publié : jeu. 30/nov./2006 0:23
par Backup
on a ecrit en meme temps :D
Flype a écrit :mais l'autre aussi fonctionne :roll: faut juste changer les couleurs.
oui effectivement autant pour moi :D