SetBkMode_(wParam,#TRANSPARENT)
SetTextColor_(wParam,RGB(55,146,23))
Mais je n'arrive pas à avoir un fond transparent, (pour voir l'image placer derrière le texte)
Merci d'avance pour les réponse

Code : Tout sélectionner
Startdrawing(ImageOutput())
DrawingMode(1)
DrawText()
....
StopDrawaing()
Code : Tout sélectionner
; English forum: http://purebasic.myforums.net/viewtopic.php?t=9202&highlight=
; Author: Num3
; Date: 17. January 2004
; Many thanks to Danilo for the base code
;My contribution is getting the background color
;so the text background always "looks" transparent!
Global TextGadgetBackground, TextGadgetForeground
color= GetSysColor_(#COLOR_3DFACE) ; get color of the background
TextGadgetBackground = CreateSolidBrush_(color)
TextGadgetForeground = RGB($FF,$FF,$00)
Procedure WinProc(hWnd,Msg,wParam,lParam)
If Msg = #WM_CTLCOLORSTATIC And lParam = GadgetID(0)
SetBkMode_(wParam,#TRANSPARENT)
SetTextColor_(wParam,TextGadgetForeground)
ProcedureReturn TextGadgetBackground
Else
ProcedureReturn #PB_ProcessPureBasicEvents
EndIf
EndProcedure
OpenWindow(0,0,0,200,25,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"TextGadget Color")
SetWindowCallback(@WinProc())
CreateGadgetList(WindowID())
TextGadget(0,5,5,190,15,"This text is colored")
Repeat:Until WaitWindowEvent()=#PB_EventCloseWindow
DeleteObject_(TextGadgetBackground)
Code : Tout sélectionner
Enumeration
#MainWindow
#image
#image1
#imageGadget
#textgadget
#font
EndEnumeration
Global Brush
#PositionX = 200
#PositionY = 100
#DecalageX = 10 ; position en x de #Image
#DecalageY = 10 ; position en Y de #Image
#TailleImageX = 100
#TailleImageY = 100
Procedure MaCallBack(Fenetre,Message,wParam,lParam)
If Message = #WM_CTLCOLORSTATIC And lParam = GadgetID(#textgadget)
SetBkMode_(wParam,#transparent)
SetTextColor_(wParam,#white)
ProcedureReturn Brush
Else
ProcedureReturn #PB_ProcessPureBasicEvents
EndIf
EndProcedure
If OpenWindow(#MainWindow, 0, 0, 390, 270, #PB_Window_ScreenCentered | #PB_Window_SystemMenu, "")
If CreateGadgetList(WindowID()) And CreateImage(#image, 370, 250)
If StartDrawing(ImageOutput())
For i = 0 To 369
Line(i, 0, i, 249, RGB(150+i,90+i, 35+i))
Next i
StopDrawing()
TextGadget(#textgadget, #PositionX, #PositionY, 100, 20, "ESSAI")
SetGadgetFont(#textgadget, LoadFont(#font,"ARIAL",14,#PB_Font_Bold))
GetClientRect_(GadgetID(#textgadget), rc.RECT)
image2 = GrabImage(#image, #Image1, #PositionX-#DecalageX,#PositionY-#DecalageY , rc\right, rc\bottom)
Brush = CreatePatternBrush_(image2)
ImageGadget(#imageGadget, #DecalageX, #DecalageY, #TailleImageX, #TailleImageY, UseImage(#image))
SetWindowCallback(@MaCallBack())
Repeat
Select WaitWindowEvent()
Case #PB_EventCloseWindow
Quit + 1
EndSelect
Until Quit
EndIf
EndIf
EndIf
DeleteObject_(Brush)
End
Code : Tout sélectionner
PureCOLOR_SetWindowColor(0, RGB($40,$5C,$80))
Code : Tout sélectionner
PureCOLOR_SetGadgetColor(#text1, RGB($FF,$FF,$FF), RGB($40,$5C,$80))
Je ne sais pas si on peut faire plus simple, à creuser.olivier a écrit :@Denis : Ouai, j'ai penser à ça. Mais j'éspérais plus simple.