|
楼主 |
发表于 2004-5-10 16:32:34
|
显示全部楼层
<>函数名: restorecrtmode
功 能: 将屏幕模式恢复为先前的imitgraph设置
用 法: void far restorecrtmode(void);
程序例: <>#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h> <>int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int x, y; <P> /* initialize graphics and local variables */
initgraph(&gdriver, &gmode, ""); <P> /* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk) /* an error occurred */
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1); /* terminate with an error code */
} <P> x = getmaxx() / 2;
y = getmaxy() / 2; <P> /* output a message */
settextjustify(CENTER_TEXT, CENTER_TEXT);
outtextxy(x, y, "Press any key to exit graphics:");
getch(); <P> /* restore system to text mode */
restorecrtmode();
printf("We're now in text mode.\n");
printf("Press any key to return to graphics mode:");
getch(); <P> /* return to graphics mode */
setgraphmode(getgraphmode()); <P> /* output a message */
settextjustify(CENTER_TEXT, CENTER_TEXT);
outtextxy(x, y, "We're back in graphics mode.");
outtextxy(x, y+textheight("W"), "Press any key to halt:"); <P> /* clean up */
getch();
closegraph();
return 0;
}
</P> |
|