Code : Tout sélectionner
Procedure AddPathRoundBox(x.d, y.d, Largeur.d, Hauteur.d, RayonCoin, Epaisseur, Couleur, pleine = #False, Drapeau = #PB_Path_Default)
MovePathCursor(x + RayonCoin, y, Drapeau & #PB_Path_Relative)
;coin haut gauche
AddPathEllipse(0, RayonCoin, RayonCoin, RayonCoin, 180, -90, #PB_Path_Relative)
;Ligne supérieure
AddPathLine((Largeur-RayonCoin*2)-Epaisseur/2, 0, #PB_Path_Relative)
;Coin haut droite
AddPathEllipse(0, RayonCoin, RayonCoin, RayonCoin, -90, 0, #PB_Path_Connected | #PB_Path_Relative)
;Ligne verticale droite
AddPathLine(0, (Hauteur-RayonCoin*2)-Epaisseur/2, #PB_Path_Relative)
;Coin Bas droite
AddPathEllipse(-RayonCoin, 0, RayonCoin, RayonCoin, 0, 90, #PB_Path_Connected | #PB_Path_Relative)
;Ligne inférieure
AddPathLine((RayonCoin + RayonCoin-Largeur) + Epaisseur/2, 0, #PB_Path_Relative)
;Coin bas gauche
AddPathEllipse(0, -RayonCoin, RayonCoin, RayonCoin, 90, 180, #PB_Path_Connected | #PB_Path_Relative)
ClosePath()
;Définir la couleur
VectorSourceColor(Couleur)
If pleine
;si pleine = #True, remplir la box
FillPath()
Else
;sinon juste tracer un trait à l'épaisseur demandée
StrokePath(epaisseur)
EndIf
EndProcedure
OpenWindow(0, 0, 0, 1920, 1040, "VectorRoundBox", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
CanvasGadget(0, 0, 0, 1920, 1040)
StartVectorDrawing(CanvasVectorOutput(0))
AddPathBox(0, 0, 1920, 1040)
VectorSourceColor($FF606060)
FillPath()
AddPathRoundBox( 100, 100, 500, 200, 20, 5, $FFAA9CFF, 1)
AddPathRoundBox( 100, 300, 500, 200, 20, 5, $FFFF9CAA)
AddPathRoundBox( 600, 100, 500, 200, 20, 5, $FFAAF9FC)
AddPathRoundBox( 600, 300, 500, 200, 20, 5, $FFF9FCAA, 1)
AddPathRoundBox(1100, 100, 500, 200, 20, 5, $FFF9AAFC)
AddPathRoundBox(1100, 300, 500, 200, 20, 5, $FFAAFCF9)
StopVectorDrawing()
Repeat
Evenement = WaitWindowEvent()
Until Evenement = #PB_Event_CloseWindow