Category : C Source Code
Archive   : COLRBORD.ZIP
Filename : COLBOR.C

 
Output of file : COLBOR.C contained in archive : COLRBORD.ZIP

/***************************************************************************/
/* By Jim Mendel 13967 Marquesas Way #29 Marina del Rey, Ca 90292 */
/* Microsoft MSC library functions */
/***************************************************************************/
#include
#include

main()
{
colbor(); /* call the color border function */
_settextposition(2,4); /* move to a position for exit text */
_outtext("Hit any key to exit"); /* show how to end program */
getch(); /* hold screen until character hit */
_setvideomode(_DEFAULTMODE); /* reset to original video mode */
}

/**************************************************************** colbor() */
/* Provides a screen with a multicolored border using 15 colors */
/* By Jim Mendel 13967 Marquesas Way #29 Marina del Rey, Ca 90292 */
/***************************************************************************/
#include
#include
colbor()
{
int i, j, k = 0, l = 0;
short x1=0, y1=0, x2=16, y2=16; /* set basic vertical block size */
_setvideomode(_VRES16COLOR); /* set VGA 16 color 640 x 480 mode */
for (i=1; i<=30; i++) /* vertical counting loop */
{
k++; /* increment color for vert blocks */
if (i == 16) /* reset vertical color loop */
k = 1;
_setcolor(k); /* color set function */
_rectangle(_GFILLINTERIOR, x1, y1, x2, y2); /* left vert block row */
_setcolor(16-k);
_rectangle(_GFILLINTERIOR, x1+618, y1, x2+618, y2); /* rt vert row */
y1 += 16; /* increment vertical block downward */
y2 += 16; /* increment vertical block downward */
}
x1=0, y1=0, x2=20, y2=16; /* set basic horizontal block size */
for (j=1; j<=30; j++) /* horizontal counting loop */
{
l++; /* increment color for horiz blocks */
if (j == 16) /* reset horizontal color loop */
l = 1;
_setcolor(16-l); /* color set function */
_rectangle(_GFILLINTERIOR, x1+17, y1, x2+17, y2);/* top hor blk row*/
_setcolor(l);
_rectangle(_GFILLINTERIOR,x1+17,y1+464,x2+17,y2+464);/* bot hor row*/
x1 += 20; /* increment horiz blocks rightward */
x2 += 20; /* increment horiz blocks rightward */
}
}