Mettre une image en fond de vos fenetres !

Vous débutez et vous avez besoin d'aide ? N'hésitez pas à poser vos questions
brossden
Messages : 833
Inscription : lun. 26/janv./2004 14:37

Mettre une image en fond de vos fenetres !

Message par brossden »

Je me permet de recopier ce poste que je trouve assez interessant sans fausse modestie (désolé :oops: )

Code : Tout sélectionner


Enumeration
  #Window : #Button :#Image
EndEnumeration
Global Win_Options.l, Image0 = CatchImage(#Image, ?Image0), rc.s = Chr(13)+Chr(10)


DataSection
Image0:
IncludeBinary "c:\windows\winnt256.bmp"
EndDataSection

Procedure Fond(Win,Ima)
  Fond.LOGBRUSH\lbStyle=3 : Fond\lbColor=0 : Fond\lbHatch=ImageID(Ima)
  SetClassLong_(WindowID(Win),-10,CreateBrushIndirect_(Fond))
EndProcedure

Procedure.l Open_Window()
  Win_Options =#PB_Window_SystemMenu|#PB_Window_ScreenCentered|  #PB_Window_MaximizeGadget
  Win_Options  | #PB_Window_MinimizeGadget|#PB_Window_SizeGadget
  OpenWindow(#Window,256,154,250,170,"Fenêtre",Win_Options)
  Fond(#Window,#Image)
  CreateGadgetList(WindowID(#Window))
  ButtonGadget(#Button,10,20,80,30,"Test")
EndProcedure

Open_Window()

Repeat ; Start of the event loop
  Event = WaitWindowEvent()
  WindowID = EventWindow()
  GadgetID = EventGadget()
  EventType = EventType()
  If Event = #PB_Event_Gadget
    If GadgetID = #Button
      ResizeWindow(#Window,0,0,520,350)
      MessageRequester("Test","Essayez d'étirer la fenêtre !")
 
    EndIf
  EndIf
Until Event = #PB_Event_CloseWindow
End
; IDE Options = PureBasic v4.02 (Windows - x86)
; CursorPosition = 40
; FirstLine = 29

Denis

Bonne Jounée à tous