Syntax
Border = CreateBorder(StyleFlags=#Null, Width.d=3, CornerRadius=#Null, Color=#PG_Ignore, Opacity.f=1)
Description
Creates a programmatically generated border object. This type of border allows defining styles (solid, dashed, etc.), width, color, opacity, and corner radii directly through parameters and subsequent `BorderSet*` commands.
Parameters
StyleFlags (optional)
A combination of flags specifying the initial border style.
Default is #Null (which results in #PG_Border_Solid). See BorderSetFlags() for a list of possible flags.
Width.d (optional)
The initial width (thickness) in DIPs for all border sides.
Default is 3. Must be >= 0.
CornerRadius (optional)
The initial radius (in DIPs) for all corners. If 0 or
#Null (default), corners are sharp (90 degrees). Must be >= 0.
Color (optional)
The initial color for all border sides. Default is
#PG_Ignore, which uses a default gray (RGB(178, 178, 178)) unless the style is
'groove', 'ridge', 'inset', or 'outset' (where color might be ignored initially or derived).
Opacity.f (optional)
The initial opacity (0.0 to 1.0) for all border sides.
Default is 1.0 (fully opaque). Must be >= 0.
Return Value
Returns a handle to the newly created generated border object if successful, or #Null if
creation failed.
Remarks
This function creates a 'generated' border type (#BorderType_Generated). Its appearance is
defined by styles, widths, colors, and radii. Complex styles (like rounded dashed/dotted borders) are
rendered internally by generating and caching an appropriate image border on-the-fly. Use CreateBorderImg() for borders explicitly defined by image assets.
Remember to free the border using FreeBorder() when no longer needed.
Example
IncludeFile "ProGUI_PB.pbi"
StartProGUI()
; Create a 5-DIP wide, red, dashed border with 10-DIP rounded corners
MyBorder = CreateBorder(#PG_Border_Dash, 5, 10, RGB(255, 0, 0), 1.0)
If MyBorder
Debug "Generated border created successfully."
; Use the border...
; DrawBorder(MyBorder, 50, 50, 200, 100)
FreeBorder(MyBorder)
Else
Debug "Failed to create border."
EndIf
StopProGUI()
See Also
CreateBorderImg, DrawBorder, BorderSetFlags, BorderSetWidth, BorderSetColor, BorderSetRadius, FreeBorder
Supported OS
Windows, Linux