Posted: Mon Nov 06, 2006 3:57 pm
Unfortunately not. Here's a little demo of how you can do it using API though:Really, can I do it without WinAPI?
Code: Select all
; Transparent gadgets demo by netmaestro
;
;================================================
; Create a gradient image to use as background
;================================================
OpenLibrary(0,"Msimg32.dll")
Prototype GradientFill(hdc,*Vert,Int1,*Rect,Int2,Flags)
GradientFill.GradientFill=GetFunction(0,"GradientFill")
Dim vert.TRIVERTEX(1)
gRect.GRADIENT_RECT
vert (0) \x = 0;
vert (0) \y = 0;
vert (0) \Red = $0000;
vert (0) \Green = $ffff;
vert (0) \Blue = $ffff;
vert (0) \Alpha = $0000;
vert (1) \x = 260;
vert (1) \y = 160;
vert (1) \Red = $ffff;
vert (1) \Green = $0ff0;
vert (1) \Blue = $ffff;
vert (1) \Alpha = $0000;
gRect\UpperLeft = 0;
gRect\LowerRight = 1;
CreateImage(0,260,160,32)
hDC = StartDrawing(ImageOutput(0))
GradientFill(hdc, @vert(), 2, @gRect, 1, #GRADIENT_FILL_RECT_H)
StopDrawing()
CloseLibrary(0)
;================================================
; Demo transparent checkbox and text gadgets
;================================================
Global GadgetFrg=#Black, GadgetBkg = GetStockObject_(#HOLLOW_BRUSH)
Procedure WindowProc(hWnd, Msg, wParam, lParam)
result = #PB_ProcessPureBasicEvents
If Msg=#WM_CTLCOLORSTATIC
Select GetDlgCtrlID_(lparam)
Case 1 To 3
SetBkMode_(wParam,#TRANSPARENT)
SetTextColor_(wParam,GadgetFrg)
result = GadgetBkg
EndSelect
EndIf
ProcedureReturn result
EndProcedure
OpenWindow(0,0,0,260,160,"test",$CF0001)
SetWindowCallback(@WindowProc())
CreateGadgetList(WindowID(0))
CheckBoxGadget(1,10,20,245,20,"This is a transparent Checkbox gadget")
CheckBoxGadget(2,10,50,245,20,"This is another transparent Checkbox gadget")
TextGadget(3, 10,82,250,20,"This is a transparent text gadget")
hBrush = CreatePatternBrush_(ImageID(0))
SetClassLong_(WindowID(0), #GCL_HBRBACKGROUND, hBrush)
InvalidateRect_(WindowID(0), 0, #True)
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
DeleteObject_(GadgetBkg)
DeleteObject_(hBrush)