RE:graficos en lenguaje c
Publicado por
meliklos (1 intervención) el 25/10/2010 15:34:26
a ver si hacemos la tarea eh???
#include <conio.h>
#include <stdlib.h>
#include <stdio.h>
#include <graphics.h>
#include <bios.h>
#define IZQ 0x4b00
#define DER 0x4d00
#define ESC 283
#define ENTER 0x1c0d
int band = 0;
void botones( int band ){
if( band == 0 ){
setcolor( 2 ); setfillstyle( 1, 7 );
bar3d( 50, 50, 180, 75, 10, 1 );
setcolor( 15 ); outtextxy( 115, 65, "Entradas" );
setfillstyle( 1, 8 ); setcolor( 2 );
bar3d( 230, 50, 360, 75, 10, 1 );
setcolor( 2 ); outtextxy( 295, 65, "Salidas" );
bar3d( 410, 50, 580, 75, 10, 1); setcolor( 2 );
outtextxy( 495, 65, "Existencia" );
}
if( band == 1 ){
setcolor( 2 ); setfillstyle( 1, 7 );
bar3d( 230, 50, 360, 75, 10, 1 );
setcolor( 15 ); outtextxy( 295, 65, "Salidas" );
setfillstyle( 1, 8 ); setcolor( 2 );
bar3d( 50, 50, 180, 75, 10, 1 );
setcolor( 2 ); outtextxy( 115, 65, "Entradas" );
bar3d( 410, 50, 580, 75, 10, 1 ); setcolor( 2 );
outtextxy( 495, 65, "Existencia" );
}
if( band == 2 ){
setcolor( 2 ); setfillstyle( 1, 7 );
bar3d( 410, 50, 580, 75, 10, 1 );
setcolor( 15 ); outtextxy( 495, 65, "Existencia" );
setfillstyle( 1, 8 ); setcolor( 2 );
bar3d( 230, 50, 360, 75, 10, 1);
setcolor( 2 ); outtextxy( 295, 65, "Salidas" );
bar3d( 50, 50, 180, 75, 10, 1 ); setcolor( 2 );
outtextxy( 115, 65, "Entradas" );
}
}
void init(){
int gdrive = DETECT, gmode = DETECT, error;
initgraph( &gdrive, &gmode, "c:\\tc\\bgi" );
error = graphresult();
if( error != grOk )
{
printf( "Error al iniciar los graficos." );
getch();
exit( 0 );
}
}
void ventanaini(){
settextstyle( 0, 0, 0 );
setfillstyle( 1, 3 );
bar( 5, 5, getmaxx() - 5, 25 );
setcolor( 15 );
line( 5, 5, getmaxx() - 5, 5 );
line( 5, 5, 5, 25 );
settextjustify( 1, 1 );
setcolor( 15 );
outtextxy( getmaxx() / 2, 15, "Mi ventana de Windows" );
}
void main(){
int tecla;
init();
cleardevice();
setbkcolor( 4 );
ventanaini();
setfillstyle( 1, 7 );
botones( band );
do{
if( bioskey( 1 ) )
{
tecla = bioskey( 1 );
bioskey( 0 );
if (tecla == IZQ && band == 0 ) band = 2;
else if (tecla == IZQ && band <= 2 ) band--;
if (tecla == DER && band == 2 ) band = 0;
else if (tecla == DER && band >= 0 ) band++;
botones( band );
}
} while( tecla != ESC);
closegraph();
}