Voila j'ai une image avec deux lignes.
Je voudrais n'effacer que la deuxieme.
J'ai eu l'aide de SROD qui m'a proposé un code qui marche mais que j'ai du mal à insérer dans mon appli qui a déja pas mal de fonction dans la callback et pas mal de skins sur mes fenetres et gadgets.
Et en plus le temps de redessiner tous les texts de la fenetre ça fait un sautement pas tres joli
 
 Code de SROD :
(Bidouillé par KCC pour rajouter l'image de fond)
Code : Tout sélectionner
Global flag 
#FontArial14Gras = 10 
#ImageCompteur = 11 
LoadFont(#FontArial14Gras, "Arial", 14,#PB_Font_Bold) 
Procedure callBack(hWnd, uMsg, wParam, lParam) 
  Result = #PB_ProcessPureBasicEvents 
  Select uMsg 
    Case #WM_PAINT  
      StartDrawing(WindowOutput(0)) 
        DrawingMode(1) 
        FrontColor(RGB(255, 255, 255)) 
        DrawingFont(FontID(#FontArial14Gras)) 
        DrawText(140, 54, "Premiere phrase") 
      If flag=#False 
          DrawText(140, 204, "Seconde phrase") 
      EndIf 
      StopDrawing() 
      ValidateRect_(hWnd, 0) 
  EndSelect 
  ProcedureReturn result 
EndProcedure 
LoadImage(#ImageCompteur, "C:\Fond.bmp") 
hWnd = OpenWindow(0, 30, 30, 383, 377, "Essais", #PB_Window_BorderLess|#PB_Window_ScreenCentered) 
; Display image 
hBrushP.l = CreatePatternBrush_(ImageID(#ImageCompteur)) 
SetClassLong_(WindowID(0), #GCL_HBRBACKGROUND, hBrushP) 
; Add #WS_EX_LAYERED style and set transparent color 
SetWindowLong_(WindowID(0), #GWL_EXSTYLE, GetWindowLong_(WindowID(0), #GWL_EXSTYLE) | #WS_EX_LAYERED) 
SetLayeredWindowAttributes_(WindowID(0), #White, 10, #LWA_COLORKEY) 
UpdateWindow_(hWnd) 
SetWindowCallback(@callback()) 
InvalidateRect_(hWnd, 0, 1) 
UpdateWindow_(hWnd) 
Delay(5000) 
flag = #True 
RedrawWindow_(hWnd, 0,0, #RDW_ERASE|#RDW_INVALIDATE|#RDW_ERASENOW) 
Repeat  
  Evenement = WaitWindowEvent () 
Until Evenement = #PB_Event_CloseWindowJe n'ai jamais fait de graphisme, alors tout ça c'est plus que du chinois pour moi.
J'ai aussi eu un super code de Demivec qui utilise GrabImage mais qui apparement ne fonctionne qu'avec un gadgetImage.
 
 Code : Tout sélectionner
#ImageCompteur = 11 
#ImageSource =12 
#FontArial14Gras = 10 
OpenWindow(0, 30, 30, 383, 377, "Essais") 
CreateGadgetList(WindowID(0)) 
LoadImage(#ImageSource,"c:\Fond.bmp") 
CopyImage(#ImageSource,#ImageCompteur) 
ImageGadget(1, 0, 0,20,50,ImageID(#ImageCompteur)) 
LoadFont(#FontArial14Gras, "Arial", 14,#PB_Font_Bold) 
StartDrawing(ImageOutput(#ImageCompteur)) 
DrawingMode(1) 
FrontColor(RGB(255, 255, 255)) 
DrawingFont(FontID(#FontArial14Gras)) 
DrawText(140, 54, "Premiere phrase") 
DrawText(140, 204, "Seconde phrase") 
StopDrawing() 
SetGadgetState(1,ImageID(#ImageCompteur)) 
Delay(2000) 
;erase text by copying source image over it 
StartDrawing(ImageOutput(#ImageCompteur)) 
DrawingFont(FontID(#FontArial14Gras)) 
provisoireImage = GrabImage(#ImageSource,#PB_Any,140,204,TextWidth("Seconde phrase"),TextHeight("Seconde phrse")) 
DrawImage(ImageID(provisoireImage),140,204) 
FreeImage(provisoireImage) 
StopDrawing() 
SetGadgetState(1,ImageID(#ImageCompteur)) 
Repeat 
  Evenement = WaitWindowEvent () 
Until Evenement = #PB_Event_CloseWindowVoici l'image :
http://purebasic.myftp.org/files/413/Fond.bmp
Et voici mon code:
Code : Tout sélectionner
#Font = 10 
#Image = 11 
LoadFont(#Font, "Arial", 14,#PB_Font_Bold) 
LoadImage(#Image, "C:\Fond.bmp") 
OpenWindow(0, 30, 30, 383, 377, "Essais", #PB_Window_BorderLess|#PB_Window_ScreenCentered) 
; Display image 
hBrushP.l = CreatePatternBrush_(ImageID(#Image)) 
SetClassLong_(WindowID(0), #GCL_HBRBACKGROUND, hBrushP) 
; Add #WS_EX_LAYERED style and set transparent color 
SetWindowLong_(WindowID(0), #GWL_EXSTYLE, GetWindowLong_(WindowID(0), #GWL_EXSTYLE) | #WS_EX_LAYERED) 
SetLayeredWindowAttributes_(WindowID(0), #White, 10, #LWA_COLORKEY) 
UpdateWindow_(WindowID(0)) 
StartDrawing(WindowOutput(0)) 
DrawingMode(1) 
FrontColor(RGB(233, 233, 233)) 
DrawingFont(FontID(#Font)) 
DrawText(110, 74, "Premiere phrase") 
DrawText(110, 224, "Seconde phrase") 
Repeat : Evenement = WaitWindowEvent():Delay(1) :Until GetAsyncKeyState_(#VK_ESCAPE)
 
  )
 ) 
 
 
  
 