Does anyone know how to create a borderless window that still keeps the drop shadow?
I'm assuming this has to be done through API which is fine, but my knowledge is pretty limited on this subject.
Any tips or examples well be very much appreciated.
Borderless window with drop shadow?
Re: Borderless window with drop shadow?
Code: Select all
Enumeration
#Window
EndEnumeration
OpenWindow(#Window, 0, 0, 200, 150, "WindowTitle", #PB_Window_BorderLess|#PB_Window_ScreenCentered|#PB_Window_Invisible)
SetClassLongPtr_(WindowID(#Window), #GCL_STYLE, $00020000)
HideWindow(#Window, #False)
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Re: Borderless window with drop shadow?
Code: Select all
Import ""
GetProcAddress(hMod, Name.p-ascii)
EndImport
#DWMWA_NCRENDERING_POLICY = 2
#DWMNCRP_ENABLED = 2
Structure Margin
cxLeftWidth.l
cxRightWidth.l
cyTopHeight.l
cyBottomHeight.l
EndStructure
Procedure DwmSetWindowAttribute(hWnd, attr, attrValue)
Static hMod
Static Func
Protected Value.integer\i = attrValue
If Not hMod And Not Func
hMod = GetModuleHandle_("dwmapi")
Func = GetProcAddress(hMod, "DwmSetWindowAttribute")
EndIf
If Func
ProcedureReturn CallFunctionFast(Func, hWnd, attr, Value, SizeOf(Value))
EndIf
ProcedureReturn -1
EndProcedure
Procedure DwmExtendFrameIntoClientArea(hWnd, Top, Left, Right, Bottom)
Static hMod
Static Func
Protected Margin.Margin
Margin\cxLeftWidth = Left
Margin\cxRightWidth = Right
Margin\cyTopHeight = Top
Margin\cyBottomHeight = Bottom
If Not hMod And Not Func
hMod = GetModuleHandle_("dwmapi")
Func = GetProcAddress(hMod, "DwmExtendFrameIntoClientArea")
EndIf
If Func
ProcedureReturn CallFunctionFast(Func, hWnd, Margin)
EndIf
ProcedureReturn -1
EndProcedure
Procedure Main()
Protected Window.i
Window = OpenWindow(#PB_Any, 150, 150, 200, 200, "Shadow Test", #PB_Window_BorderLess)
If Window
DwmSetWindowAttribute(WindowID(Window), #DWMWA_NCRENDERING_POLICY, #DWMNCRP_ENABLED)
DwmExtendFrameIntoClientArea(WindowID(Window), 1, 1, 1, 1)
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
EndProcedure: End Main()
Re: Borderless window with drop shadow?
Well, that was quick.
Thank you both for the wonderful examples.

Thank you both for the wonderful examples.
Re: Borderless window with drop shadow?
Hello hallodri,
how can the shadow width and form be changed?
thanks!
how can the shadow width and form be changed?
thanks!