The 2 borders are 5 pixels long: 0+5, 1+4, 2+3, 3+2 ?
I don't have that concern for other containers
Code: Select all
Define i.i, rcWind.Rect, rcClient.RECT
OpenWindow(0, 0, 0, 440, 240, "", #PB_Window_SystemMenu)
ScrollAreaGadget(1, 20, 20, 400, 200, 500, 300, 10)
CloseGadgetList()
ScrollAreaGadget(2, 20, 20, 400, 200, 300, 100, 10, #PB_ScrollArea_Flat)
CloseGadgetList()
CanvasGadget(3, 20, 20, 400, 200, #PB_Canvas_Container|#PB_Canvas_Border)
CloseGadgetList()
ContainerGadget(4, 20, 20, 400, 200, #PB_Container_Raised)
CloseGadgetList()
PanelGadget(5, 20, 20, 400, 200)
AddGadgetItem(5, -1, "Tab 1")
CloseGadgetList()
For i = 1 To 5
If IsGadget(i)
Select GadgetType(i)
Case #PB_GadgetType_Canvas, #PB_GadgetType_Container
GetClientRect_(GadgetID(i), @rcClient)
GetWindowRect_(GadgetID(i), @rcWind)
Debug "Gadget Border(" + i + ") " + Str((rcWind\right - rcWind\left) - rcClient\right) + "x" + Str((rcWind\bottom - rcWind\top) - rcClient\bottom)
Case #PB_GadgetType_ScrollArea
GetClientRect_(GadgetID(i), @rcClient)
GetWindowRect_(GadgetID(i), @rcWind)
If (GetWindowLongPtr_(GadgetID(i), #GWL_STYLE) & #WS_VSCROLL)
Debug "Scroll size(" + i + ") " + Str(GetSystemMetrics_(#SM_CXVSCROLL)) + "x" + Str(GetSystemMetrics_(#SM_CYHSCROLL))
Debug "Gadget Border(" + i + ") " + Str((rcWind\right - rcWind\left) - rcClient\right - GetSystemMetrics_(#SM_CXVSCROLL)) + "x" + Str((rcWind\bottom - rcWind\top) - rcClient\bottom - GetSystemMetrics_(#SM_CYHSCROLL))
Else
Debug "Gadget Border(" + i + ") " + Str((rcWind\right - rcWind\left) - rcClient\right) + "x" + Str((rcWind\bottom - rcWind\top) - rcClient\bottom)
EndIf
Case #PB_GadgetType_Panel
Debug "TabHeight(" + i + ") " + Str(GetGadgetAttribute(i, #PB_Panel_TabHeight))
;GetClientRect_(GadgetID(i), @rcClient)
;GetWindowRect_(GadgetID(i), @rcWind)
;Debug "Window Border(" + i + ") " + Str((rcWind\right - rcWind\left) - rcClient\right) + "x" + Str((rcWind\bottom - rcWind\top) - rcClient\bottom)
Debug "Gadget Border(" + i + ") " + Str(GadgetWidth(i) - GetGadgetAttribute(i, #PB_Panel_ItemWidth)) + "x" + Str(GadgetHeight(i) - GetGadgetAttribute(i, #PB_Panel_TabHeight) - GetGadgetAttribute(i, #PB_Panel_ItemHeight))
Debug "Left/Right Border(" + i + ") " + Str((GadgetWidth(i) - GetGadgetAttribute(i, #PB_Panel_ItemWidth))/2)
Define TopBorder = Int((GadgetHeight(i) - GetGadgetAttribute(i, #PB_Panel_TabHeight) - GetGadgetAttribute(i, #PB_Panel_ItemHeight))/2)
Debug "Top Border(" + i + ") !!!!! " + Str(TopBorder)
Debug "Bottom Border(" + i + ") !!!!! " + Str(GadgetHeight(i) - GetGadgetAttribute(i, #PB_Panel_TabHeight) - GetGadgetAttribute(i, #PB_Panel_ItemHeight) - TopBorder)
EndSelect
Debug ""
EndIf
Next
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow