Apparemment, il y a un bug avec SetWindowColor()
Code : Tout sélectionner
#Fenetre = 0
If OpenWindow(#Fenetre, 0, 0, 220, 100, "Exemple...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
; SetWindowColor(#Fenetre,#Yellow) ; BUG si on décommente
If StartDrawing(WindowOutput(#Fenetre))
DrawingMode(#PB_2DDrawing_Transparent)
DrawText(10,10,"ok",#Blue)
StopDrawing()
EndIf
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
que l'on peut résoudre comme ça:
Code : Tout sélectionner
#Fenetre = 0
If OpenWindow(#Fenetre, 0, 0, 220, 100, "Exemple...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
SetWindowColor(#Fenetre,#Yellow)
Repeat
If StartDrawing(WindowOutput(#Fenetre))
DrawingMode(#PB_2DDrawing_Transparent)
DrawText(10,10,"ok",#Blue)
StopDrawing()
EndIf
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
Il faut eviter d'ecrire dans la fenêtre à cause du "repaint", il vaut mieux utiliser un gadget fait pour cela, le imagegadget:
Code : Tout sélectionner
If OpenWindow(0, 0, 0, 200, 200, "DrawText Exemple", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If CreateImage(0, 200, 200) And StartDrawing(ImageOutput(0))
DrawingMode(#PB_2DDrawing_Transparent)
Box(0, 0, 200, 200, RGB(255, 255, 205))
For i = 1 To 30
DrawText(Random(200), Random(200), "Hello World!", RGB(Random(255), Random(255), Random(255)))
Next i
StopDrawing()
ImageGadget(0, 0, 0, 200, 200, ImageID(0))
EndIf
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
M.