Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "Win32api.inc"
Global hDlg, hDC, memDC, hBMP, hOverlayDlg As Dword
Function PBMain()
Dialog New Pixels, 0, "Draw",800,300,200,200, %WS_OverlappedWindow Or %WS_ClipChildren To hDlg
Control Add Button, hDlg, 501, "Under", 20,50,60,60
Control Add Button, hDlg, 502, "Not Under", 125,50,60,60
Dialog Show Modal hDlg Call DlgProc()
End Function
CallBack Function DlgProc() As Long
Select Case Cb.Msg
Case %WM_InitDialog
CreateInvisibleBitmap
Dialog New Pixels, hDlg, "", 0,0,100,180, %WS_Popup Or %WS_Visible, %WS_Ex_Layered To hOverlayDlg
Dialog Show Modeless hOverlayDlg Call OverLayProc
RefreshDrawing
Case %WM_Move
Dialog Set Loc hOverlayDlg, 0,0
End Select
End Function
CallBack Function OverlayProc() As Long
Select Case Cb.Msg
Case %WM_InitDialog
SetLayeredWindowAttributes(hOverlayDLG, %Green, 250, %LWA_ALPHA Or %LWA_Colorkey)
' SetLayeredWindowAttributes(hOverlayDLG, 0, 120, %LWA_ALPHA)
End Select
End Function
Sub RefreshDrawing 'using PB Bitmap
hDC = GetDC(hOverlayDlg)
BitBlt hDC, 0, 0, 100, 180, memDC, 0, 0, %SRCCopy
ReleaseDC(hOverlayDlg,hDC)
End Sub
Sub CreateInvisibleBitmap
Local w,h As Long
Graphic Bitmap New 100,150 To hBMP 'same size as overlay
Graphic Attach hBMP, 0
Graphic Clear %Green
Graphic Box (30,20) - (50,140),, %Red
Graphic Get DC To memDC
End Sub
'gbs_00937
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm