Page 1 of 1

Image background in ContainerGadget()

Posted: Sat Mar 12, 2011 9:27 am
by VeryVeryWell
Hello! How I can do image background in ContainerGadget()?
I try use DisableGadget() for ImageGadget (as background), but when I minimize window and maximize it again, gadgets hid...

Re: Image background in ContainerGadget()

Posted: Sat Mar 12, 2011 11:27 am
by VeryVeryWell
I found source!

Code: Select all

Enumeration
  #Window_0
EndEnumeration

Enumeration
  #Container_0
  #Button_2
EndEnumeration
;
Enumeration
  #Image_Image_1
EndEnumeration

UseJPEGImageDecoder()
Global bgimage = LoadImage(#PB_Any,"d:\VTcam-1.jpg")

Procedure OpenWindow_Window_0()
  If OpenWindow(#Window_0, 502, 56, 400, 400, "Window_0", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
      hwnd=ContainerGadget(#Container_0, 15, 10, 365, 265, #PB_Container_Raised)
      hBrush = CreatePatternBrush_(ImageID(bgimage))
      SetClassLong_(hwnd, #GCL_HBRBACKGROUND, hBrush)
      InvalidateRect_(hwnd, #Null, #True)
        ButtonGadget(#Button_2, 160, 115, 85, 20, "Gadget_2")
      CloseGadgetList()
    EndIf
EndProcedure

OpenWindow_Window_0()

;{- Event loop
Repeat
  Event = WaitWindowEvent()
  Select Event
    ; ///////////////////
    Case #PB_Event_Gadget
      EventGadget = EventGadget()
      EventType = EventType()
      If EventGadget = #Container_0
      ElseIf EventGadget = #Button_2
         Debug " ok"
      EndIf
    ; ////////////////////////
    Case #PB_Event_CloseWindow
      EventWindow = EventWindow()
      If EventWindow = #Window_0
        CloseWindow(#Window_0)
        Break
      EndIf
  EndSelect
ForEver
;
;}