C/Visual C - como hacer un rectangulo de color amarillo

 
Vista:

como hacer un rectangulo de color amarillo

Publicado por alejandro (2 intervenciones) el 28/04/2004 03:11:46
Hola:

Quisiera saber el codigo para dibujar un cuadrado de color amarillo, osea el comando para hacer figuras con colores, ojala me respondan
chabela
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:como hacer un rectangulo de color amarillo

Publicado por vicente (6 intervenciones) el 28/04/2004 17:04:43
puedes utilizar el comando poly para dibujar tu figura y con el comando fillpoly se puede rellenar, como ejemplo copia el siguiente codigo que te puede servir de referencia:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
int gdriver = DETECT, gmode, errorcode;
int i, maxx, maxy;

int poly[8];

initgraph(&gdriver, &gmode, "");

errorcode = graphresult();
if (errorcode != grOk)
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
}

maxx = getmaxx();
maxy = getmaxy();

poly[0] = 20; /* 1st vertex */
poly[1] = maxy / 2;

poly[2] = maxx - 20; /* 2nd */
poly[3] = 20;

poly[4] = maxx - 50; /* 3rd */
poly[5] = maxy - 20;

poly[6] = maxx / 2;
poly[7] = maxy / 2;

for (i=EMPTY_FILL; i<USER_FILL; i++)
{
setfillstyle(i, getmaxcolor());

fillpoly(4, poly);

getch();
}

/* clean up */
closegraph();
return 0;
}
ojala te sirva de algo ...

suerte...
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar