void modo_grafico(char ruta[]){ int gdriver = DETECT, gmode, errorcode; initgraph(&gdriver, &gmode, ruta); errorcode = graphresult(); if (errorcode != grOk) { printf("Error grafico: %s\n", grapherrormsg(errorcode)); printf("Pulse una tecla para finalizar:"); getch(); exit(1); } } // ----------------------------------------------------------------------- // FUNCIàN VENTANA CON TITULO // ----------------------------------------------------------------------- void ventana(int x1, int y1, int x2, int y2,char titulo[], int fondo_titulo, int fondo_ventana ) { setcolor(7); rectangle(x1, y1, x2, y2); // cuadro gris claro setcolor(16); line(x1, y2, x2, y2); // linea negra -- abajo line(x2, y2, x2, y1); // linea negra | derecha setcolor(15); rectangle(x1+1, y1+1, x2-1, y2-1); // cuadro blanco dentro setcolor(8); line(x1+1, y2-1, x2-1, y2-1); // gris -- abajo line(x2-1, y1+1, x2-1, y2-1); // gris | derecha int fv= (fondo_ventana) ? fondo_ventana : 7; // color del interior de setfillstyle(1,fv); // la ventana, por defecto bar(x1+2, y1+2, x2-2, y2-2); // (0) es el gris. int ft= (fondo_titulo) ? fondo_titulo : 1; // color del fondo del setfillstyle(1,ft); // t¡tulo, por defecto (0) bar(x1+3, y1+3, x2-4, y1+20); // es azul oscuro. setcolor(15); outtextxy(x1+10, y1+4, titulo); // t¡tulo de la ventana } // FIN VENTANA --------------------------------------------------------- // ----------------------------------------------------------------------- // FUNCIàN BOTON // ----------------------------------------------------------------------- void boton(int x1,int y1, int x2,int y2, int pulsado, char titulo[], int color_titulo, int fondo_boton) { setcolor(7); rectangle(x1,y1,x2,y2); // cuadro gris claro if (pulsado) { setcolor(16); line(x1, y1, x2, y1); // linea negra -- arriba line(x1, y2, x1, y1); // linea negra | izquierda setcolor(15); rectangle(x1+1,y1+1,x2-1,y2-1); //cuadro blanco dentro setcolor(8); line(x1+1, y1+1, x2-1, y1+1); // gris -- arriba line(x1+1, y1+1, x1+1, y2-1); // gris | izquierda } else { setcolor(16); line(x1, y2, x2, y2); // linea negra -- abajo line(x2, y2, x2, y1); // linea negra | derecha setcolor(15); rectangle(x1+1, y1+1, x2-1, y2-1); //cuadro blanco dentro setcolor(8); line(x1+1, y2-1, x2-1, y2-1); // gris -- abajo line(x2-1, y1+1, x2-1, y2-1); // gris | derecha } int fb= (fondo_boton) ? fondo_boton : 7; // color del interior del setfillstyle(1,fb); // bot¢n, por defecto (0) bar(x1+2, y1+2, x2-2, y2-2); // es el gris. int ct= (color_titulo) ? color_titulo : 15; setcolor(ct); // settextstyle(2,0,5); outtextxy(x1+10,y1+4,titulo); } // FIN BOTON -----------------------------------------------------------