LESTROSO wrote:...an image like a wallpaper and i have added some gadget text...., the gadget text are not shown...
You could use a disabled
ImageGadget() as a wallpaper, or background image:
Code: Select all
; ================================================
; automatically loads a sample image from DropBox
; requires later versions of PureBasic for the
; ReceiveHTTPFile() function to work with DropBox
; ================================================
Enumeration
#MainWindow
#Background
#bgImage
#Button
#TitleFont
#Candidate
#CandidateFont
EndEnumeration
UseJPEGImageDecoder()
InitNetwork()
If FileSize(GetTemporaryDirectory() + "background.jpg") = -1
ReceiveHTTPFile("https://www.dropbox.com/s/7ay877rq3eq8kwi/stairway.jpg?dl=1",
GetTemporaryDirectory() + "background.jpg")
EndIf
LoadImage(#bgImage, GetTemporaryDirectory() + "background.jpg")
LoadFont(#TitleFont, "Times New Roman", 24, #PB_Font_Italic)
LoadFont(#CandidateFont, "Times New Roman", 12, #PB_Font_Italic)
wFlags = #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_Invisible
OpenWindow(#MainWindow, #PB_Any, #PB_Any, 1000, 550, "Image Background", wFlags)
StartDrawing(ImageOutput(#bgImage))
DrawingMode(#PB_2DDrawing_Transparent)
DrawingFont(FontID(#TitleFont))
DrawText(60, 30, "Stairway to Heaven...", RGB(0, 0, 255))
StopDrawing()
ImageGadget(#Background, 0, 0, 1000, 550, ImageID(#bgImage))
StringGadget(#Candidate, 100, 230, 190, 30, "enter your name here...")
ButtonGadget(#Button, 100, 265, 190, 30, "E N T E R !")
SetGadgetFont(#Candidate, FontID(#CandidateFont))
DisableGadget(#Background, #True)
DisableGadget(#Button, #True)
HideWindow(#MainWindow, #False)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
appQuit = 1
Case #PB_Event_Gadget
Select EventGadget()
Case #Button
HideGadget(#Candidate, #True)
HideGadget(#Button, #True)
StartDrawing(ImageOutput(#bgImage))
DrawingMode(#PB_2DDrawing_Transparent)
DrawingFont(FontID(#TitleFont))
DrawText(770, 250, "Goodbye...", RGB(255, 200, 255))
StopDrawing()
SetGadgetState(#Background, ImageID(#bgImage))
Case #Candidate
Select EventType()
Case #PB_EventType_Focus
SetGadgetText(#Candidate, "")
Case #PB_EventType_Change
If Trim(GetGadgetText(#Candidate))
DisableGadget(#Button, #False)
Else
DisableGadget(#Button, #True)
EndIf
EndSelect
EndSelect
EndSelect
Until appQuit = 1
EDITS wrote:18th February 2019: updated download links