salehvasaleh
Member
چطوری می شه به هنگام کامپایل پروژه در زبان سی کاری کرد که در محیط گرافیکی رنگ زمینه رو ما تعیین کنیم؟
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
int main(void)
{
int gdriver = DETECT, gmode, errorcode;
struct palettetype far *pal=(void *) 0;
initgraph(&gdriver, &gmode, "");
errorcode = graphresult();
if (errorcode != grOk)
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to continue.");
getch();
exit(1);
}
setpalette(0, RED);
gotoxy(2,2);
printf("This is a sample.\n");
gotoxy(2,4);
printf("Press any key to continue.");
getch();
pal=getdefaultpalette();
setallpalette(pal);
closegraph();
return 0;
}