setvisualpage是一种函数,用于设置可见图形页号。
setvisualpage是一种函数,用于设置可见图形页号。
程序例子
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
int main(void)
{
int gdriver = EGA, gmode = EGAHI, errorcode;
int x, y, ht;
initgraph(&gdriver, &gmode, "");
errorcode = graphresult();
if (errorcode != grOk)
{
printf("Graphics error: %sn", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
}
x = getmaxx() / 2;
y = getmaxy() / 2;
ht = textheight("W");
setactivepage(1);
line(0, 0, getmaxx(), getmaxy());
settextjustify(CENTER_TEXT, CENTER_TEXT);
outtextxy(x, y, "This is page #1:");
outtextxy(x, y+ht, "Press any key to halt:");
setactivepage(0);
outtextxy(x, y, "This is page #0.");
outtextxy(x, y+ht, "Press any key to view page #1:");
getch();
setvisualpage(1);
getch();
closegraph();
return 0;
}