Syntax
Success = FreeBorder(Border)
Description
Releases the resources associated with a border object previously created with CreateBorder() or CreateBorderImg().
Parameters
Border
The handle of the border object to free.
Return Value
Returns #True if the border was successfully freed, or #False if the handle
was invalid.
Remarks
It is important to free border objects when they are no longer needed to prevent memory leaks. This function handles freeing internal resources, such as brushes or cached images associated with the border. For image borders, it decrements the reference count of the associated source images (freeing them if the count reaches zero). For generated borders, it frees any internally cached DPI-specific border images.
Example
IncludeFile "ProGUI_PB.pbi"
StartProGUI()
MyBorder1 = CreateBorder(#PG_Border_Solid, 2)
MyImage = CreateImg(50, 50, RGB(200, 200, 200))
MyBorder2 = CreateBorderImg(MyImage, 0, 10, 10, 10, 10)
If MyBorder1
Debug "Freeing generated border..."
FreeBorder(MyBorder1)
EndIf
If MyBorder2
Debug "Freeing image border..."
FreeBorder(MyBorder2)
EndIf
If MyImage ; Note: FreeBorder will decrement reference count, may not free immediately if used elsewhere
Debug "Freeing source image (if ref count is 0)..."
FreeImg(MyImage)
EndIf
StopProGUI()
See Also
CreateBorder, CreateBorderImg, FreeImg, FreeBrush
Supported OS
Windows, Linux