BB___BOX

=BOX= toc

Description
> For use with graphics windows and graphicboxes, BOX draws the outline of a box shape using the pen position as one corner and x y as the other corner.

> There are five graphics commands that draw shapes: >> box >> circle >> ellipse >> line >> pie

Syntax
> //This command is NOT case sensitive.//

Using literal values

 * 1)  - a graphics window
 * 2)  - a graphicbox

Using variable values
> The upper-left corner of the box is at the pen position. The lower-right corner will be at the specified x y coords.

Hints
boxfilled circlefilled ellipsefilled piefilled
 * //**Color & Size.**// Shapes are drawn with a pen color set by the command and a line thickness set by the  command.
 * //**Filled Shapes.**// You cannot draw a shape and then it with color. (The  command is used to fill the graphics window with color). Instead, to make a shape filled with color, use the complimentary //shape//filled commands:

Example
An example of the command in a graphics window. code format="lb" nomainwin

WindowWidth=400 WindowHeight=300

open "Draw Box Demo" for graphics_nsb_nf as #g #g "trapclose [quit]" 'put the pen down #g "down" 'label upper left corner #g "place 30 40" #g "\x=50 y=50" 'set pen color and size for shape #g "color green; size 2" 'place the pen at upper left corner #g "place 50 50" 'draw a 100 x 100 box #g "box 150 150" 'change pen color and size #g "color black; size 1" 'label the lower right corner #g "place 130 170" #g "\x=150 y=150" 'label box size #g "place 60 90" #g "\Box 100x100"

wait

[quit] close #g end code

An example of the command in a graphicbox. code format="lb" nomainwin

WindowWidth=400 WindowHeight=300

graphicbox #g.gb 2, 2, 390, 270 open "Draw Box Demo" for graphics_nsb_nf as #g #g "trapclose [quit]" 'put the pen down #g.gb "down" 'set pen color and size for shape #g.gb "color blue; size 3" 'place the pen at upper left corner #g.gb "place 50 50" 'draw a 100 x 100 box #g.gb "box 150 150"

wait

[quit] close #g end code

An example combining four shape commands in a graphics window. code format="lb" nomainwin

WindowWidth=400 WindowHeight=300

open "All Shapes Demo" for graphics_nsb_nf as #g #g "trapclose [quit]"

'put the pen down #g "down" 'set the pen color and size #g "color blue; size 2" 'place and draw a box #g "place 10 10; box 150 150" 'place and draw a circle #g "place 80 80; circle 40" 'place and draw an ellipse #g "place 200 200; ellipse 100 50" 'change pen color and size #g "color red; size 1" 'draw a line #g "line 10 10 200 200" #g "flush" 'make graphics stick wait

[quit] close #g end code

Useful Functions
code format="lb" Place a useful function using this keyword here. code