Restored from previous forum. Originally posted by Franco. And here is the example code:
Code:
; (c) 2001 - Franco's template - absolutely freeware
; OpenTextImageWindow(ID,Height,Width,Thickness,Flag,Font$,Text$,BMP$)
; Well, the big part is to adjust Height, Width and Thickness to the lenght of the String and the Font.
; You will see :)
;
; Height = Window Height
; Width = Window Width
; Thickness =FontThickness
; Flag can be: #RGN_AND or #RGN_XOR
Procedure OpenTextImageWindow(ID,Height,Width,Thickness,Flag,Font$,Text$,BMP$)
InitGadget(0)
If LoadImage(0, BMP$)
Structure Rect
Left.l
Top.l
Right.l
Bottom.l
EndStructure
RectRegion.Rect
If OpenWindow(ID, GetSystemMetrics_(#SM_CXSCREEN), GetSystemMetrics_(#SM_CYSCREEN), Width, Height, #WS_POPUP, Text$)
If CreateGadgetList(WindowID())
SetForegroundWindow_(WindowID())
WindowDC= GetDC_(WindowID())
Font = SelectObject_(WindowDC,CreateFont_(Height,0,0,0,Thickness,0,0,0,#ANSI_CHARSET,#OUT_CHARACTER_PRECIS,#CLIP_DEFAULT_PRECIS,#PROOF_QUALITY,0,Font$))
BeginPath_(WindowDC)
TextOut_(WindowDC,0,0,Text$,Len(Text$))
EndPath_(WindowDC)
Region1 = PathToRegion_(WindowDC)
GetRgnBox_(Region1,RectRegion)
Region2 = CreateRectRgnIndirect_(RectRegion)
CombineRgn_(Region2,Region2,Region1,Flag)
DeleteObject_(Region1)
ReleaseDC_(WindowID(),WindowDC)
SetWindowRgn_(WindowID(),Region2,1)
SelectObject_(WindowDC,Font)
SetWindowPos_(WindowID(),#HWND_TOPMOST,(GetSystemMetrics_(#SM_CXSCREEN)/2)-(WindowWidth()/2),(GetSystemMetrics_(#SM_CYSCREEN)/2)-(WindowHeight()/2),Width,Height,0)
ImageGadget(0, ((Width)/2)-(ImageWidth()/2), ((Height)/2)-(ImageHeight()/2), 0, 0, UseImage(0))
WindowEvent() : WindowEvent() : WindowEvent() ; Thanks to Mr.Skunk :)
EndIf
EndIf
EndIf
EndProcedure
OpenTextImageWindow(0,130,560,300,#RGN_XOR,"Verdana","PureBasic","c:\windows\clouds.bmp")
Delay(1000)
CloseWindow(0)
OpenTextImageWindow(1,100,580,100,#RGN_XOR,"Verdana","Feel The Pure","c:\windows\clouds.bmp")
Delay(1000)
CloseWindow(1)
OpenTextImageWindow(2,150,560,1500,#RGN_AND,"Verdana","POWER","c:\windows\clouds.bmp")
Delay(2000)
CloseWindow(2)
That's it!
Have a nice day...
Franco