/* Program BOX_1.C
**
** Illustrates how to draw a box. Note that xy screen coords are
** 0,0 (upper left) to 500,700 (lower right).
**
** P. H. Anderson, 30 Sept 93
**
*/
#include <stdio.h>
#include <graphics.h>
#include <dos.h>
void draw_box (int startx, int starty, int endx, int endy, int color);
/* draws an empty box with outline of lines having specified color */
void main(void)
{
int graphdriver = DETECT, graphmode, linestyle=0;
initgraph(&graphdriver, &graphmode, "c:\\turboc");
/* detect and initialize graphics system */
setlinestyle(SOLID_LINE, linestyle, THICK_WIDTH);
draw_box(50, 50, 300, 200, RED);
setcolor(GREEN);
/* draw a cross in the box */
line(50, 50, 300, 200);
line(300, 50, 50, 200);
sleep(10); /* pause to admire */
closegraph();
}
void draw_box (int startx, int starty, int endx, int endy, int color)
{
setcolor(color);
rectangle(startx, starty, endx, endy);
}