Box()

Syntax

Box(x, y, Width, Height [, Color])
Description
Draw a filled box of given dimensions on the current output. The current output is set with StartDrawing().

If the 'Color' parameter is not specified, the default color set with FrontColor() will be used. RGB() can be used to get a valid color value. A color table with common colors is available here.

Example:
  ; Several boxes with random colors
  Width=200
  Height=150
  If OpenWindow(0, 0, 0, Width, Height, "Boxes", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    If StartDrawing(WindowOutput(0))
      y = 0
      #StepX = 10
      StepY = Round(#StepX*Height/Width, 0)
      For x = 0 To Width/2-5 Step #StepX
        Box(x, y, Width-2*x, Height-2*y ,RGB(Random(255),Random(255),Random(255)))
        y + StepY     ; the same as y = y + StepY
      Next x
      StopDrawing()   ; This is absolutely needed when the drawing operations are finished !!! Never forget it !
    EndIf
    
    Repeat : Event = WaitWindowEvent() : Until  Event = #PB_Event_CloseWindow
  EndIf

Supported OS

All

<- BackColor() - 2DDrawing Index - Circle() ->