restorecrtmode

restorecrtmode是一個函式,用於螢幕模式恢復先前initgraph設定。

基本介紹

  • 中文名:restorecrtmode
  • 功 能:螢幕模式恢復先前initgraph設定
  • 用 法:void far restorecrtmode
  • 程式例:#include
函式名,功能,簡介,

函式名

restorecrtmode

功能

將螢幕模式恢復為先前的initgraph設定

簡介

用 法: void far restorecrtmode(void);
程式例:
#include
#include
#include
#include
int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int x, y;
/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, "");
/* 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 */
}
x = getmaxx() / 2;
y = getmaxy() / 2;
/* output a message */
settextjustify(CENTER_TEXT, CENTER_TEXT);
outtextxy(x, y, "Press any key to exit graphics:");
getch();
/* restore system to text mode */
restorecrtmode();
printf("We're now in text mode.\n");
printf("Press any key to return to graphics mode:");
getch();
/* return to graphics mode */
/* 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:");
/* clean up */
getch();
closegraph();
return 0;
}

相關詞條

熱門詞條

聯絡我們